Gathering detailed insights and metrics for @dtpui/dtp-vscode-ws-jsonrpc
Gathering detailed insights and metrics for @dtpui/dtp-vscode-ws-jsonrpc
NPM module to implement communication between a jsonrpc client and server over WebSocket
npm install @dtpui/dtp-vscode-ws-jsonrpc
Typescript
Module System
Min. Node Version
Node Version
NPM Version
73.3
Supply Chain
89.4
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
355
Last Day
1
Last Week
2
Last Month
13
Last Year
78
MIT License
38 Commits
1 Branches
1 Contributors
Updated on Apr 19, 2023
Minified
Minified + Gzipped
Latest Version
3.0.3
Package Id
@dtpui/dtp-vscode-ws-jsonrpc@3.0.3
Unpacked Size
52.67 kB
Size
11.48 kB
File Count
52
NPM Version
9.5.0
Node Version
18.14.2
Published on
Apr 19, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-50%
2
Compared to previous week
Last Month
18.2%
13
Compared to previous month
Last Year
-71.8%
78
Compared to previous year
1
NPM module to implement communication between a jsonrpc client and server over WebSocket.
See the following example code how to use this library or take a look of the monaco-languageclient
and vscode-ws-jsonrpc
examples here:
1import { MessageConnection, NotificationType } from 'vscode-jsonrpc'; 2import { listen } from 'vscode-ws-jsonrpc'; 3 4const webSocket = new WebSocket('ws://www.example.com/socketserver'); 5listen({ 6 webSocket, 7 onConnection: (connection: MessageConnection) => { 8 const notification = new rpc.NotificationType<string, void>('testNotification'); 9 connection.listen(); 10 connection.sendNotification(notification, 'Hello World'); 11 } 12});
1import { createWebSocketConnection, ConsoleLogger, IWebSocket } from 'vscode-ws-jsonrpc'; 2import { NotificationType } from 'vscode-languageserver'; 3 4const socket: IWebSocket; // open the web socket 5const logger = new ConsoleLogger(); 6const connection = createWebSocketConnection(socket, logger); 7const notification = new NotificationType<string, void>('testNotification'); 8connection.onNotification(notification, (param: string) => { 9 console.log(param); // This prints Hello World 10}); 11 12connection.listen();
1import { IWebSocket, WebSocketMessageReader, WebSocketMessageWriter } from 'vscode-ws-jsonrpc'; 2import { createConnection, createServerProcess, forward } from 'vscode-ws-jsonrpc/server'; 3import { Message } from 'vscode-languageserver'; 4 5const socket: IWebSocket; // open the web socket 6const reader = new WebSocketMessageReader(socket); 7const writer = new WebSocketMessageWriter(socket); 8const socketConnection = createConnection(reader, writer, () => socket.dispose()) 9const serverConnection = createServerProcess('Example', 'node', ['example.js']); 10forward(socketConnection, serverConnection, message => { 11 if (Message.isNotification(message)) { 12 if (message.method === 'testNotification') { 13 // handle the test notification 14 } 15 } 16 return message; 17});
No vulnerabilities found.
No security vulnerabilities found.