mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Format websocket doc
This commit is contained in:
parent
f258f28689
commit
40b8411f25
1 changed files with 17 additions and 16 deletions
|
@ -6,19 +6,20 @@ You can easily create a websocket handler which matches the route of `ws://host:
|
|||
with different routes.
|
||||
|
||||
```ruby
|
||||
ws "/" do |socket|
|
||||
ws "/" do |socket|
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
ws "/route2" do |socket|
|
||||
ws "/route2" do |socket|
|
||||
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
Let's access the socket and create a simple echo server.
|
||||
|
||||
```ruby
|
||||
ws "/" do |socket|
|
||||
# Matches "/"
|
||||
ws "/" do |socket|
|
||||
# Send welcome message to the client
|
||||
socket.send "Hello from Kemal!"
|
||||
|
||||
|
@ -31,5 +32,5 @@ Let's access the socket and create a simple echo server.
|
|||
socket.on_close do
|
||||
puts "Closing socket"
|
||||
end
|
||||
end
|
||||
end
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue