Format websocket doc

This commit is contained in:
Sdogruyol 2015-12-16 20:21:17 +02:00
parent f258f28689
commit 40b8411f25

View file

@ -6,19 +6,20 @@ You can easily create a websocket handler which matches the route of `ws://host:
with different routes. with different routes.
```ruby ```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. Let's access the socket and create a simple echo server.
```ruby ```ruby
ws "/" do |socket| # Matches "/"
ws "/" do |socket|
# Send welcome message to the client # Send welcome message to the client
socket.send "Hello from Kemal!" socket.send "Hello from Kemal!"
@ -31,5 +32,5 @@ Let's access the socket and create a simple echo server.
socket.on_close do socket.on_close do
puts "Closing socket" puts "Closing socket"
end end
end end
``` ```