voodoo-client
The voodoo client is used to "communicate" with the voodoo-server over whatever transport you choose to use.
Creating the client
const Client = const client =
Done. But now you have to add a transport to be able to do anything else then logging in.
client.transport([function])
Plugins
There are few included transport plugins:
tcp
The tcp transport takes the same arguments as net.connect
const tcptransport = vo
websocket
The websocket transport is based on engine.io-client takes the same arguments as engine.io-client
const wstransport = vo
client.login({credentials})
Login return a axios Promise
and automatically store the token for future requests over the given transport.
client
client.define(name, [handler])
The send command can be sent as many times as you like until you choose to end the subject.
client
- res.send({message}) send the given message
- res.error({error}) send the given error
- res.end({message}) send the given message(optional) and end the rpc stream
client.run(name, {data}, [callback])
client
client.subscribe(name, [handler])
client
client.emit(name, {data})
client