UNPKG

raas-server

Version:
35 lines 894 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const net = require("net"); const socket = new net.Socket(); socket.on('data', message => { console.log(message.toString()); }); socket.on('connect', () => { console.log('connected'); initialize(); }); socket.connect(61435); let messageId = 1; function send(method, params) { const message = { jsonrpc: '2.0', id: messageId++, method: method, params: params }; const json = JSON.stringify(message); const headers = `Content-Length: ${json.length} \r\n\r\n`; socket.write(headers, 'ASCII'); socket.write(json, 'UTF-8'); } function initialize() { send('server/startServerAsync', { rootPath: process.cwd(), processId: process.pid, capabilities: { /* ... */ } }); } //# sourceMappingURL=socket_test.js.map