-
Notifications
You must be signed in to change notification settings - Fork 0
Description
I need some advice on how the websocket connection should work in JS and how data should be returned from the library. The current implementation is an experiment and should not be taken seriously.
The design in my head:
Connect(vaultID: string, keyHash: string, token: string) - Returns some sort of channel (Or whatever the equivalent is in JavaScript). Spawn a thread in the plugin to listen to push operations from the server.
Pull(uid: string) - Sends a pull request through the websocket. Returns the binary and metadata
Push(...) etc
At least this is how I would do this in Golang. However, in JS, websockets are implemented with an onmessage callback. I do not know of a way to receive objects in order and know what type of message is being received.