public bool createAccount(bool voice) //throws IOException { string path = voice ? CREATE_ACCOUNT_VOICE_PATH : CREATE_ACCOUNT_SMS_PATH; makeRequest(string.Format(path, credentialsProvider.GetUser()), "GET", null); return(true); }
public WebSocketConnection(String httpUri, TrustStore trustStore, CredentialsProvider credentialsProvider, string userAgent) { this.trustStore = trustStore; this.credentialsProvider = credentialsProvider; this.wsUri = httpUri.Replace("https://", "wss://") .Replace("http://", "ws://") + $"/v1/websocket/?login={credentialsProvider.GetUser()}&password={credentialsProvider.GetPassword()}"; this.userAgent = userAgent; }
public SignalWebSocketConnection(CancellationToken token, string httpUri, CredentialsProvider credentialsProvider, string userAgent) { Token = token; CredentialsProvider = credentialsProvider; UserAgent = userAgent; if (credentialsProvider.GetDeviceId() == SignalServiceAddress.DEFAULT_DEVICE_ID) { WsUri = httpUri.Replace("https://", "wss://") .Replace("http://", "ws://") + $"/v1/websocket/?login={credentialsProvider.GetUser()}&password={credentialsProvider.GetPassword()}"; } else { WsUri = httpUri.Replace("https://", "wss://") .Replace("http://", "ws://") + $"/v1/websocket/?login={credentialsProvider.GetUser()}.{credentialsProvider.GetDeviceId()}&password={credentialsProvider.GetPassword()}"; } UserAgent = userAgent; WebSocket = new WebSocketWrapper(WsUri, token); WebSocket.OnConnect(Connection_OnOpened); WebSocket.OnMessage(Connection_OnMessage); }