![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@noveo/dual-rpc-ws
Advanced tools
Connect to the server using an address and unique id that concrete the client
Call the server method using params as one argument construction. Returns a Promise with the JSON response from the server
Register the method on the client side, handler must return an object or a Promise<object> which will be held on the server side
In this time we can send messages to the server, the connection is accepted
when detail
argument is true. Otherwise the connection is aborted
Setup the server with ws.ServerOptions object.
hanshake
is the handler for the new connections. It accepts client token, Websocket instance
of the new connection and returns true
if connection can be established and false to broke the connection
Call the client with the token method using params as one argument construction. Returns a Promise with the JSON response from the client
Register the method on the server side, handler accepts token of the client it was called and params as an object and must return an object or a Promise<object> which will be held on the client side
Client
const client = new Client('id1', 'ws://localhost:8081');
client.addEventListener('handshake', (event) => {
console.log('We can send messages to the server with this token:', event.detail);
if (event.detail === true) {
client.call('ping').then((data) => {
console.log('ping data:', data)
});
setInterval(async () => {
try {
const a = await client.call('hi', { a: 2 });
console.log(a);
} catch (e) {}
}, 20000);
}
});
client.register('hi', (params) => {
console.log('client hi', params);
return Promise.resolve(`hello, ${params.b}`);
});
Server
import Server from '@noveo/dual-rpc-ws';
const server = new Server({
port: 8081,
handshake: async (id) => {
console.log('connected', id);
return Promise.resolve(true);
},
});
server.register('hi', (token: string, params: any) => {
console.log('server hi', params);
return Promise.resolve(`${token}, hello, ${params.a}`);
});
setInterval(async () => {
try {
const a = await server.call('id1', 'hi', { b: 2 });
console.log(a);
} catch (e) {}
}, 20000);
FAQs
Remote procedure call
The npm package @noveo/dual-rpc-ws receives a total of 2 weekly downloads. As such, @noveo/dual-rpc-ws popularity was classified as not popular.
We found that @noveo/dual-rpc-ws demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.