Skip to content

Commit

Permalink
Merge branch 'main' of github.com:propensive/coaxial
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Feb 11, 2024
2 parents 45afdd1 + 2c24f73 commit e8f7562
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,17 @@ with.
So a UDP server which responds to `PING` messages with `PONG`, but ignores
other messages could be implemented with just:
```scala
udp"1722".listen: packet =>
val server = udp"1722".listen: packet =>
if packet.as[Text] == t"PING" then Reply(t"PONG") else Ignore
```

The return value, `server`, is a `SocketService` representing the server
running in the background, and will be returned as soon as the port has been
bound. It may be stopped at any time by calling its `stop` method, like so:
```scala
server.stop()
```




Expand Down

0 comments on commit e8f7562

Please sign in to comment.