public Connect ( string uri, string protocol = null, string authToken = null ) : Task | ||
uri | string | |
protocol | string | |
authToken | string | |
return | Task |
public async void Open(string url, string protocol = null, string authToken = null) { try { if (_websocket != null) { EndConnection(); } _websocket = new WebSocketWrapper(); _websocket.Closed += _websocket_Closed; _websocket.Opened += _websocket_Opened; _websocket.Error += _websocket_Error; _websocket.MessageReceived += _websocket_MessageReceived; if (url.StartsWith("https")) { url = url.Replace("https://", "wss://"); } else if (url.StartsWith("http")) { url = url.Replace("http://", "ws://"); } await _websocket.Connect(url, protocol, authToken); } catch (Exception ex) { OnError(ex.Message); } }
public async void Open(string url, string protocol = null, string authToken = null) { try { if (_websocket != null) EndConnection(); _websocket = new WebSocketWrapper(); _websocket.Closed += _websocket_Closed; _websocket.Opened += _websocket_Opened; _websocket.Error += _websocket_Error; _websocket.MessageReceived += _websocket_MessageReceived; if (url.StartsWith("https")) url = url.Replace("https://", "wss://"); else if (url.StartsWith("http")) url = url.Replace("http://", "ws://"); await _websocket.Connect(url, protocol, authToken); } catch (Exception ex) { OnError(ex.Message); } }