Search in sources :

Example 1 with WebsocketMessage

use of net.runelite.http.api.ws.WebsocketMessage in project runelite by runelite.

the class WSService method onMessage.

@OnMessage
public void onMessage(Session session, String text) {
    WebsocketMessage message = gson.fromJson(text, WebsocketMessage.class);
    logger.info("Got message: {}", message);
    if (message instanceof Handshake) {
        Handshake hs = (Handshake) message;
        uuid = hs.getSession();
    }
}
Also used : WebsocketMessage(net.runelite.http.api.ws.WebsocketMessage) Handshake(net.runelite.http.api.ws.messages.Handshake) OnMessage(javax.websocket.OnMessage)

Example 2 with WebsocketMessage

use of net.runelite.http.api.ws.WebsocketMessage in project runelite by runelite.

the class WSClient method onMessage.

@Override
public void onMessage(WebSocket webSocket, String text) {
    WebsocketMessage message = GSON.fromJson(text, WebsocketMessage.class);
    log.debug("Got message: {}", message);
    eventBus.post(message);
}
Also used : WebsocketMessage(net.runelite.http.api.ws.WebsocketMessage)

Aggregations

WebsocketMessage (net.runelite.http.api.ws.WebsocketMessage)2 OnMessage (javax.websocket.OnMessage)1 Handshake (net.runelite.http.api.ws.messages.Handshake)1