acheong08 / acheong08/obi-sync-lib

Library Design

Offen
#1 41 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
21
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.