Browse files

Merge pull request #91 from kyubuns/send_binary

Added method of binary data send
  • Loading branch information...
2 parents 9ee9e44 + 2745e90 commit bb16f20c0371bb53515fab475d2a6ea590354844 @mloughran mloughran committed Sep 12, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 lib/em-websocket/connection.rb
View
10 lib/em-websocket/connection.rb
@@ -166,6 +166,16 @@ def send(data)
return nil
end
+ # Send a WebSocket binary frame.
+ #
+ def send_binary(data)
+ if @handler
+ @handler.send_frame(:binary, data)
+ else
+ raise WebSocketError, "Cannot send binary before onopen callback"
+ end
+ end
+
# Send a ping to the client. The client must respond with a pong.
#
# In the case that the client is running a WebSocket draft < 01, false

0 comments on commit bb16f20

Please sign in to comment.