_client.websocket.client.on('connectFailed', function (error) { if (_client.connection.state == states.connection.retryingConnection && scheduleReconnection(false)) { } else { _client.connection.state = states.connection.connectFailed; if (_client.serviceHandlers.connectFailed) { _client.serviceHandlers.connectFailed.apply(client, [error]); } else { console.log("Connect Failed!"); } } });
/** @return {Promise<Connection>} */ static connect(requestUrl, protocols, origin, headers, options) { return new Promise((resolve, reject) => { const client = new Client(); client.on('connect', (connection) => { resolve(connection); }); client.on('connectFailed', (err) => { reject(err); }); client.connect(requestUrl, protocols, origin, headers, options); }); }
client.on('connectFailed', (error) => { console.error('Connection attempt failed', error); client.abort(); });
this.client.on('connect', function(connection) { if (successCallback != undefined) successCallback(); connection.on('error', function(error) { if (errorCallback != undefined) errorCallback(error.toString()); }); connection.on('close', function() { api.client = undefined; }); connection.on('message', function(message) { if (message.type === 'utf8') { var json = parser.convert(message.utf8Data); api.socketUpdate(json.updates); } }); });
init(wrapper_key, zeroNetHost = "localhost:43110", secureWs = false) { if (!wrapper_key) throw "No wrapper_key" this.wrapper_key = wrapper_key this.zeroNetHost = zeroNetHost this.secureWs = secureWs this.waiting_cb = {} this.message_queue = [] this.next_message_id = 1 signale.info("Creating websocket connection") this.ws = new WebsocketClient({ maxReceivedMessageSize: 83886080, maxReceivedFrameSize: 83886080 }) this.ws.on("connect", x => this.onOpen(x)) this.ws.on("connectFailed", x => this.onError(x)) this.connect() this.inited = true }
const client = new WebSocketClient() client.on('connectFailed', (error) => { reject(error) }) client.on('connect', (connection) => { resolve(connection) }) data: this.got.token }) connection.on('message', ({ type, utf8Data }) => { if (type !== 'utf8') return const { command, data } = JSON.parse(utf8Data) }) connection.on('close', () => reject(new Error('Closed too early'))) }) this.got.connection = connection
this.client.on('connectFailed', function(error) { if (errorCallback != undefined) errorCallback(error.toString()); });
ws_client.on('connectFailed', function (error) { ss_fail_count[ri]++; console.log('Connect Error: ' + error.toString() + ' - ' + ss_fail_count[ri]); }); ws_client.on('connect', function (conn) { console.log('<======= [request_noti_ws] - connection - ' + ri + ' - ' + xm2mri); timerID[xm2mri] = setTimeout(checkResponse, resp_timeout, ri, xm2mri, conn); conn.on('error', function (error) { conn.on('close', function () { conn.on('message', function (message) { console.log(message.utf8Data.toString());
ws.on('connectFailed', function (error) { console.log('Initial connection failed: ' + error.toString()); }); ws.on('connect', function (connection) { console.log('Websocket client connected'); connection.on('message', processMessage); connection.on('close', function (reasonCode, description) { console.log('Connection closed: ' + reasonCode); }); connection.on('error', function (error) { console.log('Connection error: ' + error.toString()); });
const client = new WebSocketClient(); client.on('connectFailed', error => { console.log('Connect Error: ${error}'); }); client.on('connect', function(connection) { console.log('WebSocket Client Connected'); connection.send(JSON.stringify(subscription)); connection.on('error', function(error) { console.log("Connection Error: " + error.toString()); }); connection.on('close', function() { console.log('Connection Closed'); }); connection.on('message', function(message) { if (message.type === 'utf8') { console.log("Received: '" + message.utf8Data + "'");
_client.websocket.client.on('connect', function (connection) { _client.websocket.connection = connection; _client.websocket.messageid = 0; //Reset MessageID on new connection connection.on('error', function (error) { _client.websocket.connection = undefined; _client.connection.state = states.connection.errorOccured; connection.on('close', function () { if (_client.connection.state != states.connection.retryingConnection) { _client.connection.state = states.connection.disconnected; connection.on('message', function (message) { var handled = false; if (_client.serviceHandlers.messageReceived) {
client.on('connect', (connection) => { console.log('Connected!'); connection.on('error', (error) => { console.error('Error during connection', error); connection.close(); }); connection.on('close', () => { console.log('Connection closed!'); }); connection.on('message', (message) => { const content = JSON.parse(message.utf8Data); switch (content.action) {
ws_client.on('connectFailed', function (error) { console.log('[nonblocking-async-ws] Connect Error: ' + error.toString()); ws_client.removeAllListeners(); }); ws_client.on('connect', function (connection) { console.log('<---- [nonblocking-async-ws] ' + nu); console.log(bodyString); connection.sendUTF(bodyString); connection.on('error', function (error) { console.log("[nonblocking-async-ws] Connection Error: " + error.toString()); }); connection.on('close', function () { console.log('[nonblocking-async-ws] Connection Closed'); }); connection.on('message', function (message) { console.log('----> [nonblocking-async-ws] ' + message.utf8Data.toString());
client.on('connectFailed', (error) => { console.error('Connection attempt failed', error); client.abort(); });
client.on('connect', (connection) => { console.log('Connected!'); connection.on('error', (error) => { console.error('Error during connection', error); connection.close(); }); connection.on('close', () => { console.log('Connection closed!'); }); connection.on('message', (message) => { const content = JSON.parse(message.utf8Data); switch (content.action) {