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
Updates socket.io network extension to correctly detect and manage connection to socket.io server versions 0.9.x - 1.x #11441
Conversation
…nnection to socket.io server versions 0.9.x - 1.x This commit is a combination of the following commits: -update handshake and handshakeResponse methods to work with both 0.9.x and 1.x socket.io versions, successfully parsing session id, heartbeat and timeout -adds SocketIOPacket class and updates socket send, disconnect and emit methods -update the receive / onMessage method, seperate for v0.9 and 1.0 -implements simple string packets, disconnect call, event name detection -correctly parse endpoint and event names from the payload for socket.io 1.x -implement json writing for socket.io 1.x message and event sending -fixes endpoint handling between .9 and 1, cleans up some codes -safeguard against non-existing clients -this occurs when you connect to an endpoint without connecting to the default namespace "" or "/" first -onMessage and onConnect are no longer required to be overridden and should be deprecated in the future -onError and onClose will still be used to communicate network level issues, but seperate socket.io event handlers should be created -socket.io connect, errors and disconnects are now handled as socket.io events, while network layer error and close are still implemented by the delegate -update comments and license header -fix event name and payload parsing for 0.9 method -update tests with separate tests for socket.io 0.9.x and 1.x using the same test layer and a version initializer -add missing register call for json message handler -add constructor to take version as argument, update host used for tests to dev.channon.us Signed-off-by: Chris Hannon <himynameschris@gmail.com>
… direct log calls, fix passing std::string to log as '%s' by using c_str() (causes build to fail on android and linux when passing std::string directly) Signed-off-by: Chris Hannon <himynameschris@gmail.com>
@minggo @ricardoquesada Is socket.io support something that is being kept in v4? Also, should this update be backported to v3.x and included in cocos2d-js as well? (the existing bindings should work without modification as the updates are backwards compatible) |
@hannon235 |
Ok, makes sense. I will port this over to the v3 branch, if I should be using a different branch such as v3.6 let me know |
#include "rapidjson/document.h" | ||
#include "rapidjson/stringbuffer.h" | ||
#include "rapidjson/writer.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the cocos2d 3rd party libraries has the name json instead of rapidjson...
i think it should be #include "json/xxx.h"
See #11538 |
Sorry meant #11583 |
awesome.. Thanks ... will check on it.. |
This commit is a combination of the following commits:
-update handshake and handshakeResponse methods to work with both 0.9.x and 1.x socket.io versions, successfully parsing session id, heartbeat and timeout
-adds SocketIOPacket class and updates socket send, disconnect and emit methods
-update the receive / onMessage method, seperate for v0.9 and 1.0
-implements simple string packets, disconnect call, event name detection
-correctly parse endpoint and event names from the payload for socket.io 1.x
-implement json writing for socket.io 1.x message and event sending
-fixes endpoint handling between .9 and 1, cleans up some codes
-safeguard against non-existing clients
-this occurs when you connect to an endpoint without connecting to the default namespace "" or "/" first
-onMessage and onConnect are no longer required to be overridden and should be deprecated in the future
-onError and onClose will still be used to communicate network level issues, but seperate socket.io event handlers should be created
-socket.io connect, errors and disconnects are now handled as socket.io events, while network layer error and close are still implemented by the delegate
-update comments and license header
-fix event name and payload parsing for 0.9 method
-update tests with separate tests for socket.io 0.9.x and 1.x using the same test layer and a version initializer
-add missing register call for json message handler
-add constructor to take version as argument, update host used for tests to dev.channon.us
Signed-off-by: Chris Hannon himynameschris@gmail.com