Skip to content

Conversation

@camden11
Copy link
Contributor

Description and Context

This does the initial setup work for the LocalDevWebsocketServer and adds project upload functionality as an example of how it will work. It's still a work in progress, so leaving it commented out for now.

Screenshots

https://hubspot.slack.com/archives/C076QV345ME/p1747160870258469

TODO

The rest of the LocalDevWebsocketServer work will be added in follow up PRs. The next step is probably to update LocalDevState to be immutable, and to establish a pattern for LocalDevProcess and the dev servers to interact with the server.

Testing

If you want, you can test this out using Postman or Insomnia or something similar.

  1. Uncomment the websocket related things in unifiedFlow.ts
  2. Run hs project dev
  3. Grab the websocket server port, either by running hs project dev with --debug and looking at the logs, or by hitting the port manager server localhost:8000/servers
  4. Connect to the websocket server on Insomnia
  5. Send an upload message `{"type": "upload"}

Who to Notify

@brandenrodgers @kemmerle @joe-yeager

Copy link
Contributor

@brandenrodgers brandenrodgers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@camden11 camden11 merged commit b7e950c into main May 14, 2025
1 check passed
@camden11 camden11 deleted the setup-websocket-server-2 branch May 14, 2025 14:09
Comment on lines +97 to +100
this.server.on('connection', ws => {
this._websocket = ws;
this.setupMessageHandlers();
});
Copy link
Contributor

@joe-yeager joe-yeager May 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might be problematic for multiple connections. Anytime a new connection is made, I believe it will overwrite the previous connection. So if the user were to have multiple local dev page tabs open, only the most recent tab would have a functioning websocket connection.

Edit: Actually, I think it will still get messages, we just won't have a way to reference it. I think we might want to make this a list of websockets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohhh this is a good callout. I didn't test beyond one connection. I'll address this in another PR!

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.

4 participants