OpenClient
Open a WebSocket connection to another service with OPENCLIENT() and send messages that wait for an answer.
OPENCLIENT(url, [id]) opens a WebSocket connection to another service and lets you send messages that wait for an answer. Several clients with the same URL share one connection, which reconnects by itself.
var client = OPENCLIENT('https://service.example.com/$client/');
client.online(function(meta) {
console.log(meta ? 'online' : 'offline');
});
client.message(function(msg) {
console.log('Message', msg);
});
var result = await client.rpc({ type: 'users' }, 5000);rpc() adds a callbackid to the message; the service answers with { callbackid, error, response }. For WebSocket routes in your own application read WebSockets.