acheong08 / acheong08/obi-sync-lib

Library Design

Aperta
#1 41 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
21
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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.

CC @oskardotglobal

- https://github.com/acheong08/obi-sync/issues/29

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.