connect static method
초기 실행
Implementation
static Future<Channel> connect(
ChannelHandler channelHandler, {
String? url,
}) async {
if (url != null) {
VChatCloud.url = url;
}
if (_isInitialized && _socket.closeCode == null) {
return _channel;
}
try {
final uri = Uri.parse("wss://${VChatCloud.url}:9001/eventbus/websocket");
_socket = WebSocketChannel.connect(uri);
await _socket.ready;
_channel = Channel(_socket, channelHandler);
_isInitialized = true;
return _channel;
} catch (e) {
if (e is Error) {
debugPrintStack(label: e.toString(), stackTrace: e.stackTrace);
}
rethrow;
}
}