60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/openc3/streams/web_socket_client_stream.rb', line 60
def read
while true
if @handshaked
msg = @frame.next
return msg.data if msg
end
data = super()
return data if data.length <= 0
if @handshaked
@frame << data
msg = @frame.next
return msg.data if msg
else
index = 0
chars = ""
data.each_char do |char|
@handshake << char
chars << char
index += 1
if @handshake.finished?
@handshaked = true
break
end
end
if @handshaked
data = data[index..-1]
@frame << data
return
end
end
end
end
|