8000 Prefer `#readpartial` which is better suited for an input loop. · destructobeam/async-websocket@16284e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 16284e3

Browse files
committed
Prefer #readpartial which is better suited for an input loop.
1 parent 29e4f08 commit 16284e3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/async/websocket/connection.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ def initialize(socket, driver)
5050
attr :url
5151

5252
def next_event
53+
@socket.flush
54+
5355
while @queue.empty?
54-
data = @socket.read(1024)
55-
puts data.inspect
56+
data = @socket.readpartial(1024)
5657

5758
if data and !data.empty?
5859
@driver.parse(data)

lib/async/websocket/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@
2020

2121
module Async
2222
module WebSocket
23-
VERSION = "0.4.1"
23+
VERSION = "0.5.0"
2424
end
2525
end

0 commit comments

Comments
 (0)
0