@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()); }