org.springframework.web.socket.messaging.SessionConnectedEvent Java Examples

The following examples show how to use org.springframework.web.socket.messaging.SessionConnectedEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WebSocketEventListener.java    From springboot-websocket-demo with Apache License 2.0 5 votes vote down vote up
@EventListener
public void handleWebSocketConnectListener(SessionConnectedEvent event) {
    InetAddress localHost;
    try {
        localHost = Inet4Address.getLocalHost();
        LOGGER.info("Received a new web socket connection from:" + localHost.getHostAddress() + ":" + serverPort);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }

}
 
Example #2
Source File: WebSocketEventListener.java    From xechat with MIT License 5 votes vote down vote up
/**
 * 建立连接监听
 *
 * @param sessionConnectedEvent
 */
@EventListener
public void handleConnectListener(SessionConnectedEvent sessionConnectedEvent) throws ErrorCodeException {
    log.debug("建立连接 -> {}", sessionConnectedEvent);

    user = (User) sessionConnectedEvent.getUser();
    if (!CheckUtils.checkUser(user)) {
        throw new ErrorCodeException(CodeEnum.INVALID_PARAMETERS);
    }

    UserCache.addUser(user.getUserId(), user);
}
 
Example #3
Source File: WebSocketEventListener.java    From code with Apache License 2.0 5 votes vote down vote up
@EventListener
public void handleWebSocketConnectListener(SessionConnectedEvent event) {
    InetAddress localHost;
    try {
        localHost = Inet4Address.getLocalHost();
        LOGGER.info("Received a new web socket connection from:" + localHost.getHostAddress() + ":" + serverPort);
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
    }

}
 
Example #4
Source File: WebSocketEventListener.java    From code with Apache License 2.0 4 votes vote down vote up
@EventListener
public void handleWebSocketConnectListener(SessionConnectedEvent event) {
    logger.info("Received a new web socket connection");
}
 
Example #5
Source File: WebSocketEventListener.java    From springboot-learn with MIT License 4 votes vote down vote up
@EventListener
public void handleWebSocketConnectListener(SessionConnectedEvent event) {
    logger.info("Received a new web socket connection");
}