Search in sources :

Example 1 with MyHttpAppSession

use of sample.httpjs.MyHttpAppSession in project kontraktor by RuedigerMoeller.

the class TestCrashClose method main.

public static void main(String[] args) {
    boolean http = false;
    ConnectableActor connectable;
    if (!http) {
        connectable = new WebSocketConnectable(MyHttpApp.class, "ws://localhost:8080/ws").serType(SerializerType.JsonNoRef);
    } else {
        connectable = new HttpConnectable(MyHttpApp.class, "http://localhost:8080/api").serType(SerializerType.JsonNoRef);
    }
    connectable.connect((connector, error) -> {
        System.out.println("connection lost " + connector);
    }).then((res, err) -> {
        MyHttpApp myApp = (MyHttpApp) res;
        myApp.login("dummy", "dummy").then((s, err1) -> {
            MyHttpAppSession session = s;
            System.out.println("session connected " + session);
            session.subscribe((result, e) -> {
                System.exit(0);
            });
        });
    });
}
Also used : SerializerType(org.nustaq.kontraktor.remoting.encoding.SerializerType) ConnectableActor(org.nustaq.kontraktor.remoting.base.ConnectableActor) MyHttpApp(sample.httpjs.MyHttpApp) HttpConnectable(org.nustaq.kontraktor.remoting.http.HttpConnectable) WebSocketConnectable(org.nustaq.kontraktor.remoting.websockets.WebSocketConnectable) MyHttpAppSession(sample.httpjs.MyHttpAppSession) HttpConnectable(org.nustaq.kontraktor.remoting.http.HttpConnectable) MyHttpApp(sample.httpjs.MyHttpApp) ConnectableActor(org.nustaq.kontraktor.remoting.base.ConnectableActor) MyHttpAppSession(sample.httpjs.MyHttpAppSession) WebSocketConnectable(org.nustaq.kontraktor.remoting.websockets.WebSocketConnectable)

Aggregations

ConnectableActor (org.nustaq.kontraktor.remoting.base.ConnectableActor)1 SerializerType (org.nustaq.kontraktor.remoting.encoding.SerializerType)1 HttpConnectable (org.nustaq.kontraktor.remoting.http.HttpConnectable)1 WebSocketConnectable (org.nustaq.kontraktor.remoting.websockets.WebSocketConnectable)1 MyHttpApp (sample.httpjs.MyHttpApp)1 MyHttpAppSession (sample.httpjs.MyHttpAppSession)1