Socket.D v2.5.12

创建客户端会话

</> markdown

会话的详细接口,请参考:《监听与会话》

1、单服务端时

const sessoin = await SocketD.createClient("sd:ws://127.0.0.1:8602")
        .listen(SocketD.newEventListener().doOn("hello", (s, m) => {
            conolse.info(m);
        }))
        .open();

2、多服务端时,使用集群客户端

const sessoin = await SocketD.createClusterClient("sd:ws://127.0.0.1:8602", 
                            "sd:ws://127.0.0.1:8603", 
                            "sd:ws://127.0.0.1:8604")
        .listen(SocketD.newEventListener().doOn("hello", (s, m) => {
            conolse.info(m);
        }))
        .open();