Skip to content

Commit

Permalink
Added information on stopping a service
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Feb 10, 2024
1 parent c7c6d56 commit 3da62b5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion doc/basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,16 @@ 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()
```



0 comments on commit 3da62b5

Please sign in to comment.