Example usage for org.springframework.web.socket WebSocketSession getId

List of usage examples for org.springframework.web.socket WebSocketSession getId

Introduction

In this page you can find the example usage for org.springframework.web.socket WebSocketSession getId.

Prototype

String getId();

Source Link

Document

Return a unique session identifier.

Usage

From source file:ch.rasc.wampspring.message.UnsubscribeMessage.java

/**
 * Creates an internal unsubscribe message. The system creates this message when the
 * WebSocket session ends and sends it to the subscribed message handlers for cleaning
 * up//from   ww w  . j  av a 2  s .c o  m
 *
 * @param sessionId the WebSocket session id
 **/
public static UnsubscribeMessage createCleanupMessage(WebSocketSession session) {
    UnsubscribeMessage msg = new UnsubscribeMessage("**");

    msg.setWebSocketSessionId(session.getId());
    msg.setPrincipal(session.getPrincipal());
    msg.setWampSession(new WampSession(session));

    msg.cleanup = true;

    return msg;
}

From source file:ch.rasc.wampspring.message.WampMessage.java

public static <T extends WampMessage> T fromJson(WebSocketSession session, JsonFactory jsonFactory, String json)
        throws IOException {

    WampSession wampSession = new WampSession(session);

    T newWampMessage = fromJson(jsonFactory, json, wampSession);

    newWampMessage.setWebSocketSessionId(session.getId());
    newWampMessage.setPrincipal(session.getPrincipal());
    newWampMessage.setWampSession(wampSession);

    return newWampMessage;
}

From source file:cz.cvut.fel.webrtc.db.WebRegistry.java

public WebUser getBySession(WebSocketSession session) {
    return users.get(session.getId());
}

From source file:cz.cvut.fel.UserRegistry.java

public UserSession getBySession(WebSocketSession session) {
    return usersBySessionId.get(session.getId());
}

From source file:org.kurento.tutorial.helloworld.UserSession.java

public UserSession(WebSocketSession session) {
    this.id = session.getId();
}

From source file:com.uplink.mowitnow.websocket.MowItNowWebSocketHandler.java

@Override
public void afterConnectionEstablished(WebSocketSession session) throws Exception {

    logger.info("Connection is established :" + session.getId());
}

From source file:com.omni.fansoffury.TestEchoWebSocketHandler.java

@Override
public void afterConnectionEstablished(WebSocketSession session) {
    logger.info("Session established with server " + session.getId());
    this.session = session;
    try {//ww w  .j a  va  2s. c  om
        sendMessage("Hi");
    } catch (IOException e) {
        e.printStackTrace();
    }
}

From source file:org.emmanuel.spring.chat.handlers.EchoMessageHandler.java

/**
 * Invoked after WebSocket negotiation has succeeded and the WebSocket
 * connection is opened and ready for use.
 *
 * @throws Exception this method can handle or propagate exceptions; see
 * class-level Javadoc for details.//w w  w. ja v a  2s  . c om
 `
 */
public void OnOpen(WebSocketSession wss) throws Exception {
    if (!sessions.containsKey(wss.getId())) {
        sessions.put(wss.getId(), wss);
    }
}

From source file:com.devicehive.websockets.util.SessionMonitor.java

public void registerSession(final WebSocketSession session) {
    sessionMap.put(session.getId(), session);
}

From source file:org.emmanuel.spring.chat.services.ChatRoomServices.java

public void onOpenConnection(WebSocketSession wss, String nickName) {
    if (nickName == null || nickName.trim().equals("")) {
        nickName = wss.getId();
    }//from w w w.j a  v a 2  s.co  m
    // Every User is mapped to a session and added to this container
    userSessionConnections.put(nickName, wss);
}