Files
Artem Bilan 580f19f025 Migrate Zip sample from SI-Extensions
* Migrate `cafe-scripted` to GraalVM Polyglot
* Fix emails for authors
* Upgrade some deps
2024-10-03 16:33:51 -04:00
..
2024-10-03 16:33:51 -04:00
2018-11-19 18:42:41 -05:00

== TCP Broadcast Sample

This sample demonstrates broadcasting a message received by a web controller to all connected TCP clients.

`curl -X POST http://localhost:8080/broadcast/foo` will send 'foo' to 5 connected clients.

The TCP server listens on port 1234.


`2018-11-19 12:01:48.546  INFO 98411 --- [           main] com.example.TcpBroadcastApplication      : Started TcpBroadcastApplication in 1.904 seconds (JVM running for 2.345)`
`connected! from client# 5`
`connected! from client# 4`
`connected! from client# 3`
`connected! from client# 2`
`connected! from client# 1`

`curl -X POST http://localhost:8080/broadcast/foo`

`foo from client# 4`
`foo from client# 5`
`foo from client# 2`
`foo from client# 1`
`foo from client# 3`

To shut down the application:

`curl http://localhost:8080/shutdown`