Skip to content
徐昊 edited this page Nov 10, 2018 · 2 revisions

Normal Disconnection

ConnectionInfo info = new ConnectionInfo("104.238.184.237", 8080);
IConnectionManager manager = OkSocket.open(info);
manager.disconnect();

Custom Exception In Disconnecting

ConnectionInfo info = new ConnectionInfo("104.238.184.237", 8080);
IConnectionManager manager = OkSocket.open(info);
manager.disconnect(new CustomException("custom exception"));

ATTENTION: If you want to unregister receiver, you'd better call unRegisterReceiver method in the callback onSocketDisconnection. Otherwise you might never received onSocketDisconnection callback