Skip to content

Commit

Permalink
websocket
Browse files Browse the repository at this point in the history
  • Loading branch information
komekome09 committed Jul 12, 2018
1 parent c02d120 commit 5dc95d4
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions websocket.cr
@@ -0,0 +1,19 @@
require "http/web_socket"

puts "open socket"
socket = HTTP::WebSocket.new("wss://echo.websocket.org/")

spawn do
while true
msg = gets()
if msg
socket.send(msg)
end
end
end

socket.on_message do |message|
puts "[#{Time.now}]: #{message}"
end

socket.run

0 comments on commit 5dc95d4

Please sign in to comment.