这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@sazzer
Copy link
Contributor

@sazzer sazzer commented Aug 1, 2025

No description provided.

private static final Logger LOG = LoggerFactory.getLogger(ServerLiveTest.class);

@Test
void startServer() throws Exception {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've written this as a live test, but it's not really a test. It's just a convenient way to run the server code.


server.start();

Thread.currentThread().join();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed otherwise the method immediately ends and the server stops.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a sample HTML file that uses the Socket.IO JavaScript library to connect to the server.

Comment on lines 29 to 31
server.addDisconnectListener(client -> {
LOG.info("Disconnection from client {}", client.getRemoteAddress());
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we demo the client leaving the room here, or that is automatic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's automatic when a client disconnects that they are removed from any rooms they're in. I've mentioned this in the article now.

@theangrydev theangrydev merged commit 6652236 into eugenp:master Aug 8, 2025
1 check passed
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