How to use the websocket.WebSocketClient function in websocket

To help you get started, we’ve selected a few websocket examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Kinoma / kinomajs / xs6 / xsedit / features / devices / configs / element / helper / main.js View on Github external
wsConnect(xsedit) {
		let context = this;
		let url = "ws://" + xsedit;
		
		let helper = this;
		let ws = this.ws = new WebSocketClient(url);
		ws.onopen = function() {
// 			trace("WSC: onopen\n");
			try {
				this.helper = helper;
				var uuid = require.weak("uuid");
				this.send(uuid.get());
			}
			catch (e) {
				this.helper.wsErrorResponse(500, HTTP_ERROR_500);
			}
		}
		ws.onmessage = function(message) {
// 			trace("WSC: onmessage " + message.data + "\n");
			try {
				let json = JSON.parse(message.data);
				let helper = this.helper;