infinyon / http-source-connector

Official Infinyon HTTP Source Connector
https://www.fluvio.io/connectors/inbound/http/
Apache License 2.0
7 stars 7 forks source link

Send multiple messages to WebSocket sources #245

Closed benmanns closed 1 month ago

benmanns commented 1 month ago

This updates the WebSocket connector to add a subscription_messages (plural) config to websocket_config, which allows sending multiple subscription messages to a WebSocket source endpoint.

I have made some design decisions here that I'm open to modification on:

I find this necessary for third-party WebSocket sources such as the Polygon.io Options WebSocket endpoint, which requires at least two messages, one for authentication and one per data channel.

For reference, my connection config for the Polygon.io options data looks like:

meta:
  version: latest
  name: polygon-options-websocket-connector
  type: websocket-source
  topic: {TOPIC}
http:
  endpoint: wss://socket.polygon.io/options
  websocket_config:
    subscription_messages:
      - '{"action":"auth","params":"{POLYGON_API_KEY}"}'
      - '{"action":"subscribe","params":"T.*,A.*,AM.*"}'
benmanns commented 1 month ago

Thanks for the feedback! I'll address your comments and the merge conflicts between the two branches shortly.

benmanns commented 1 month ago

@digikata thanks for the review! I addressed the merge conflicts from #244, your comments, updated the connector documentation in the README with the new config option, and bumped to v0.4.0.

digikata commented 1 month ago

Looks good @benmanns, thanks for the changes!

ajhunyady commented 1 month ago

It would be great to add an example using new newly added field subscription_messages.