-
Notifications
You must be signed in to change notification settings - Fork 766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connection closed after receiving MessagePacked string #1024
Comments
@mollenthiel Thanks for bringing this up 👍 I'm not an expert when it comes to MessagePack, maybe Ratchet doesn't support this (which would be odd as you're the first one opening a ticket about this ^^), or something else is causing this. I'm currently not seeing what you're doing exactly, if you can share some code examples I can take a closer look. I'm also interested what message the Client receives when Ratchet closes the connection, do you have any information about this? You could also try to use a tool like Wireshark to take a look what's exactly being sent over the network and if this matches your expectations. |
@SimonFrings Thank you for your answer |
public function onClose(ConnectionInterface $conn): void
{
echo 'close '.$conn->resourceId."\n";
dump($conn);
$conn->close();
}
:
close 987
^ Ratchet\WebSocket\WsConnection^ {#692
#wrappedConn: Ratchet\Server\IoConnection^ {#683
#conn: React\Socket\Connection^ {#658
#listeners: array:3 [
"data" => array:1 [
0 => Closure($data)^ {#680
class: "Ratchet\Server\IoServer"
this: Ratchet\Server\IoServer {#389 …}
use: {
$conn: React\Socket\Connection^ {#658}
}
}
]
"close" => array:1 [
0 => Closure()^ {#682
class: "Ratchet\Server\IoServer"
this: Ratchet\Server\IoServer {#389 …}
use: {
$conn: React\Socket\Connection^ {#658}
}
}
]
"error" => array:1 [
0 => Closure(Exception $e)^ {#678
class: "Ratchet\Server\IoServer"
this: Ratchet\Server\IoServer {#389 …}
use: {
$conn: React\Socket\Connection^ {#658}
}
}
]
]
#onceListeners: []
+unix: false
+encryptionEnabled: false
+stream: stream resource {@987
timed_out: false
blocked: false
eof: false
stream_type: "tcp_socket/ssl"
mode: "r+"
unread_bytes: 0
seekable: false
options: array:1 [
"socket" => array:1 [
"backlog" => 511
]
]
}
-input: React\Stream\DuplexResourceStream^ {#679
#listeners: array:6 [
"data" => array:1 [
0 => Closure()^ {#641
class: "React\Stream\Util"
use: {
$event: "data"
$target: React\Socket\Connection^ {#658}
}
}
]
"end" => array:1 [
0 => Closure()^ {#684
class: "React\Stream\Util"
use: {
$event: "end"
$target: React\Socket\Connection^ {#658}
}
}
]
"error" => array:1 [
0 => Closure()^ {#686
class: "React\Stream\Util"
use: {
$event: "error"
$target: React\Socket\Connection^ {#658}
}
}
]
"close" => array:2 [
0 => Closure()^ {#642
class: "React\Stream\Util"
use: {
$event: "close"
$target: React\Socket\Connection^ {#658}
}
}
1 => array:2 [
0 => React\Socket\Connection^ {#658}
1 => "close"
]
]
"pipe" => array:1 [
0 => Closure()^ {#685
class: "React\Stream\Util"
use: {
$event: "pipe"
$target: React\Socket\Connection^ {#658}
}
}
]
"drain" => array:1 [
0 => Closure()^ {#690
class: "React\Stream\Util"
use: {
$event: "drain"
$target: React\Socket\Connection^ {#658}
}
}
]
]
#onceListeners: []
-stream: stream resource @987
-loop: React\EventLoop\StreamSelectLoop^ {#380
-futureTickQueue: React\EventLoop\Tick\FutureTickQueue^ {#369
-queue: SplQueue {#388
-flags: 4
-dllist: []
mode: IT_MODE_FIFO | IT_MODE_KEEP
dllist: []
}
}
-timers: React\EventLoop\Timer\Timers^ {#358
-time: null
-timers: []
-schedule: []
-sorted: true
-useHighResolution: true
}
-readStreams: array:1 [
778 => stream resource {@778
timed_out: false
blocked: false
eof: false
stream_type: "tcp_socket/ssl"
mode: "r+"
unread_bytes: 0
seekable: false
options: array:1 [
"socket" => array:1 [
"backlog" => 511
]
]
}
]
-readListeners: array:1 [
778 => Closure($master)^ {#370
class: "React\Socket\TcpServer"
this: React\Socket\TcpServer {#345 …}
use: {
$that: React\Socket\TcpServer {#345 …}
}
}
]
-writeStreams: []
-writeListeners: []
-running: true
-pcntl: true
-pcntlPoll: false
-signals: React\EventLoop\SignalsHandler^ {#366
-signals: []
}
}
-bufferSize: 65536
-buffer: React\Stream\WritableResourceStream^ {#677
#listeners: array:3 [
"error" => array:1 [
0 => Closure($error)^ {#634
class: "React\Stream\DuplexResourceStream"
this: React\Stream\DuplexResourceStream^ {#679}
use: {
$that: React\Stream\DuplexResourceStream^ {#679}
}
}
]
"close" => array:1 [
0 => array:2 [
0 => React\Stream\DuplexResourceStream^ {#679}
1 => "close"
]
]
"drain" => array:1 [
0 => Closure()^ {#638
class: "React\Stream\DuplexResourceStream"
this: React\Stream\DuplexResourceStream^ {#679}
use: {
$that: React\Stream\DuplexResourceStream^ {#679}
}
}
]
]
#onceListeners: []
-stream: stream resource @987
-loop: React\EventLoop\StreamSelectLoop^ {#380}
-softLimit: 65536
-writeChunkSize: -1
-listening: false
-writable: false
-closed: true
-data: ""
}
-readable: false
-writable: false
-closing: false
-listening: false
}
+"decor": Ratchet\Server\IoConnection^ {#683}
}
+"resourceId": 987
+"remoteAddress": "195.127.48.139"
+"httpHeadersReceived": true
+"httpRequest": GuzzleHttp\Psr7\Request^ {#635
-method: "GET"
-requestTarget: null
-uri: GuzzleHttp\Psr7\Uri^ {#580
-scheme: "http"
-userInfo: ""
-host: "io.mydomain.com"
-port: 8180
-path: "/"
-query: "UUID=ruk49d1b-4066-4be1-8116-798ac5b3e970"
-fragment: ""
-composedComponents: null
}
-headers: array:8 [
"Host" => array:1 [
0 => "io.mydomain.com:8180"
]
"Sec-WebSocket-Version" => array:1 [
0 => "13"
]
"Sec-WebSocket-Key" => array:1 [
0 => "BUdgAXNUU0S67lrYutmmkw=="
]
"X-Forwarded-For" => array:1 [
0 => "90.119.235.5"
]
"X-Forwarded-Host" => array:1 [
0 => "io.battleofcastles.com:443"
]
"X-Forwarded-Server" => array:1 [
0 => "io.battleofcastles.com"
]
"Upgrade" => array:1 [
0 => "WebSocket"
]
"Connection" => array:1 [
0 => "Upgrade"
]
]
-headerNames: array:8 [
"host" => "Host"
"sec-websocket-version" => "Sec-WebSocket-Version"
"sec-websocket-key" => "Sec-WebSocket-Key"
"x-forwarded-for" => "X-Forwarded-For"
"x-forwarded-host" => "X-Forwarded-Host"
"x-forwarded-server" => "X-Forwarded-Server"
"upgrade" => "Upgrade"
"connection" => "Connection"
]
-protocol: "1.1"
-stream: null
}
+"WebSocket": {#664
+"closing": true
}
}
} (Updated by @clue to add appropriate code block, please take the time to properly format your comments.) |
Could you provide a minimal Gist for the client and server side in order to reproduce your situation? |
It's ok now. |
@mollenthiel Thanks for sharing your answer in here and confirming that Ratchet supports MessagePack 👍 |
Ratchet closes the webSocket connection when it receives a MessagePack packed string from the client.
If the client send a MessagePack packed int, it's ok, but not with a MessagePack packed string.
The text was updated successfully, but these errors were encountered: