Skip to content

Pr/basic websocket#64

Open
alexeyslynko wants to merge 3 commits into
VoliJS:developfrom
alexeyslynko:pr/basic-websocket
Open

Pr/basic websocket#64
alexeyslynko wants to merge 3 commits into
VoliJS:developfrom
alexeyslynko:pr/basic-websocket

Conversation

@alexeyslynko

Copy link
Copy Markdown

Summary

Adds a basic WebSocket endpoint to @type-r/endpoints.

The implementation provides collection live updates through subscribe() / unsubscribe() and keeps REST operations separate. Multiple collections using the same WebSocket URL, constructor, and protocols share one WebSocket connection, while each collection still sends its own subscribe/unsubscribe messages.

Included

  • websocketIO(url, options?) for basic collection live updates
  • restfulWebsocketIO(url, websocketUrl, options?) combining restfulIO CRUD/list with WebSocket live updates
  • shared WebSocket connection registry
  • support for updated / removed live update messages
  • compact message envelopes: { updated } and { removed }
  • documentation for both endpoint helpers

Basic Options

WebSocketEndpointOptions intentionally stays small:

  • WebSocket
  • protocols
  • match
  • subscribeMessage
  • unsubscribeMessage

The basic endpoint uses JSON messages only. It does not include reconnect, heartbeat, subscribe acknowledgements, cursors, replay, resync, or custom message encoding.

Testing

  • rollup --config in endpoints passed
  • Full tsc was not runnable in the local workspace with the current TypeScript 6 setup because the old branch has existing unrelated type/config incompatibilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant