Esempio n. 1
0
  @OnOpen
  public void open(Session session) {
    peers.add(session);
    Tweet tweet = new Tweet();
    tweet.setAuthor("THE SERVER");
    tweet.setMessage("Welcome! We will provide you with data " + "as soon as we have it available");
    List<Tweet> tweets = Arrays.asList(tweet);
    session.getAsyncRemote().sendText(Tweet.listToJsonArray(tweets).toString());

    logger.info("opened session with id " + session.getId());
  }
Esempio n. 2
0
 public void handleMessage(Tweet tweet, Session session) {
   handleMessage(Arrays.asList(tweet), session);
 }