Search in sources :

Example 1 with Handshake

use of net.runelite.http.api.ws.messages.Handshake 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 Handshake

use of net.runelite.http.api.ws.messages.Handshake in project runelite by runelite.

the class WSClient method connect.

void connect() {
    Request request = new Request.Builder().url(RuneLiteAPI.getWsEndpoint()).build();
    webSocket = client.newWebSocket(request, this);
    Handshake handshake = new Handshake();
    handshake.setSession(session.getUuid());
    send(handshake);
}
Also used : Request(okhttp3.Request) Handshake(net.runelite.http.api.ws.messages.Handshake)

Aggregations

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