repejota / phpnats

A PHP client for the NATSio cloud messaging system.

Home Page:http://nats.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compatibility between clients in different languages

djalal opened this issue · comments

I'm trying to read messages in PHP, that have been published through Golang code.

Those messages have been published using the Golang officially supported client. The code is directly taken from the vanilla examples in README, no fancy thing added.

Yet, it does not work, unless I use PHP on both sides (pub/sub) or Golang on both sides.

Please advise.

Yet, it does not work, unless I use PHP on both sides (pub/sub) or Golang on both sides.

Did you have any errors on the PHP side ? That can help us to give more help.

No error really, the code stopped after timeout in wait(), as if gnatsd was accepting the connection but ignoring SUB command. I can send you a trace of send() and receive() from the Connection class.

here is it :

[TRACE] send=CONNECT {"lang":"php","version":"0.8.0","verbose":true,"pedantic":true}
[TRACE] receive=INFO {"server_id":"XQFHG9VFHS506DQEVQF5N3","version":"0.8.2","go":"go1.5.3","host":"localhost","port":4222,"auth_required":false,"ssl_required":false,"tls_required":false,"tls_verify":false,"max_payload":1048576}
[TRACE] send=PING
[TRACE] receive=+OK
[TRACE] send=SUB foo qorf7rcT8ctpE5ox
[TRACE] receive=PONG
[TRACE] receive=+OK
[TRACE] receive=+OK
[TRACE] receive=
[TRACE] send=UNSUB qorf7rcT8ctpE5ox

It look like the PHP client is correctly connected. What did you see if you check the debug log from the nats server, to see when the Go client send a message ?

SOLVED : after enabling trace+debug on server side (-DV), this is related to Nats Streaming Server, who sits on top of gnatds and does extra magic with the Spec. Using nats Go client with phpnats on a gnatsd works alright though.