Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add separate websocket example #344

Merged
merged 3 commits into from
Mar 10, 2023

Conversation

loganmay
Copy link
Contributor

@loganmay loganmay commented Feb 19, 2023

Switch distributed example to websockets

@spoenemann
Copy link
Contributor

Thanks for the contribution @loganmay! I propose to replace the previous HTTP-based solution because it's very restictive. Could you change the existing example to use your WebSocket-based code?

You need to sign the Eclipse Contributor Agreement and sign-off your commit (with git commit -s) using the same email address as with your Eclipse account to pass the ECA check.

@loganmay loganmay force-pushed the add-websocket-example branch 2 times, most recently from cb81757 to 1f762a4 Compare February 28, 2023 04:29
@loganmay
Copy link
Contributor Author

@spoenemann replaced the previous solution, signed the agreement, and signed-off the commit

@loganmay loganmay force-pushed the add-websocket-example branch from 1f762a4 to cc2b56e Compare February 28, 2023 12:46
examples/package.json Show resolved Hide resolved
const diagramServer = new DiagramServer(async (action: Action) => {
const msg = JSON.stringify({ clientId: incomingMessage.clientId, action });
socket.send(msg);
}, services);
Copy link
Contributor

Choose a reason for hiding this comment

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

Proposal: define the DiagramServer outside the message handler (but inside the connection handler). That way it stays the same server instance as long as the connection remains open, which is relevant in more complex cases where the server might send updates to the client.

@loganmay loganmay requested a review from spoenemann March 10, 2023 03:06
Copy link
Contributor

@spoenemann spoenemann left a comment

Choose a reason for hiding this comment

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

The WebSocket URL needs to be fixed to run in Gitpod, but I'll do that afterwards.

@spoenemann spoenemann merged commit f3cd4b2 into eclipse-sprotty:master Mar 10, 2023
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.

2 participants