Code example for JSONStringer

Methods: endObjectobjecttoString

0
    public String getGameId() {
        return game.getId();
    } 
 
    private String generateStateMessage() {
        JSONStringer stringer = new JSONStringer();
        stringer.object();
        game.writeOutJsonObject(stringer, true);
        stringer.endObject();
 
        return stringer.toString();
    } 
 
    @Override 
    public String path() {
        return path;
    } 
 
    @Override 
    public void onOpen(WebSocket conn, ClientHandshake handshake) {
        connections.add(conn);