Example usage for javax.websocket Session getUserProperties

List of usage examples for javax.websocket Session getUserProperties

Introduction

In this page you can find the example usage for javax.websocket Session getUserProperties.

Prototype

Map<String, Object> getUserProperties();

Source Link

Usage

From source file:com.mycompany.wolf.Router.java

private static String remoteAddress(Session session) {
    return Optional.ofNullable(session.getUserProperties().get("javax.websocket.endpoint.remoteAddress"))
            .map(Object::toString).orElse("?.?.?.?");
}

From source file:com.mycompany.wolf.Room.java

private static String getPlayerId(Session session) {
    return (String) session.getUserProperties().get("playerId");
}

From source file:com.mycompany.wolf.Room.java

private static Boolean isPrepared(Session session) {
    return (Boolean) session.getUserProperties().get("prepared");
}

From source file:com.ChatEndpoint.java

@OnClose
public void onClose(Session session) {
    String nick = (String) session.getUserProperties().get("nick");
    ch.quitarUsuario(nick);//w  w w  .  ja v  a 2 s .  co m
    log.log(Level.INFO, "conexion cerrada {0}", nick);
}

From source file:org.jboss.aerogear.sync.server.wildfly.SyncEndpoint.java

private void checkForReconnect(final String documentId, final String clientId, final Session session) {
    if (getOrDefault(session.getUserProperties(), Boolean.FALSE) == Boolean.TRUE) {
        return;//  w ww. jav a2s  .  co  m
    }
    logger.info("Reconnected client [" + clientId + "]. Adding as listener.");

    final WildflySubscriber subscriber = new WildflySubscriber(clientId, session);
    syncEngine.connectSubscriber(subscriber, documentId);
}

From source file:com.mycompany.wolf.Game.java

public void competeRole(Session session, String role) {
    String playerId = (String) session.getUserProperties().get("playerId");
    rooms.values().stream().filter(r -> r.contains(playerId)).findAny().ifPresent(room -> {
        room.competeRole(playerId, role);
    });//from w  w  w.  ja va  2 s.  com
}

From source file:com.mycompany.wolf.Game.java

public void prepare(Session session, boolean flag) {
    String playerId = (String) session.getUserProperties().get("playerId");
    rooms.values().stream().filter(r -> r.contains(playerId)).findAny().ifPresent(room -> {
        room.prepare(playerId, flag);/*  w w w. jav a  2s.co  m*/
    });
}

From source file:com.mycompany.wolf.Game.java

public void enableMicrohpone(Session session, boolean flag) {
    String playerId = (String) session.getUserProperties().get("playerId");
    rooms.values().stream().filter(r -> r.contains(playerId)).findAny().ifPresent(room -> {
        room.enableMicrophone(session, flag);
    });/*from  w  ww . j av  a2s.  c  o  m*/
}

From source file:com.mycompany.wolf.Game.java

public void wolfVote(Session session, String votedPlayerId) {
    String playerId = (String) session.getUserProperties().get("playerId");
    rooms.values().stream().filter(r -> r.contains(playerId)).findAny().ifPresent(room -> {
        room.wolfVote(session, votedPlayerId);
    });/* w  w  w  .  jav  a2s  .  c o m*/
}

From source file:com.mycompany.wolf.Game.java

public void witchSave(Session session, String savedPlayerId) {
    String playerId = (String) session.getUserProperties().get("playerId");
    rooms.values().stream().filter(r -> r.contains(playerId)).findAny().ifPresent(room -> {
        room.witchSave(session, savedPlayerId);
    });/* www  .  jav  a  2 s. c  om*/
}