axmol/tests/cpp-tests/Classes/ExtensionsTest/NetworkTest/SocketIOTest.cpp

270 lines
10 KiB
C++
Raw Normal View History

Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
//
// SocketIOTest.cpp
// TestCpp
//
// Created by Chris Hannon on 6/26/13.
//
//
#include "SocketIOTest.h"
#include "../ExtensionsTest.h"
USING_NS_CC;
USING_NS_CC_EXT;
2014-01-02 16:25:35 +08:00
using namespace cocos2d::network;
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
SocketIOTestLayer::SocketIOTestLayer(void)
: _sioClient(nullptr)
, _sioEndpoint(nullptr)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
//set the clients to NULL until we are ready to connect
2013-07-13 19:21:31 +08:00
Size winSize = Director::getInstance()->getWinSize();
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
const int MARGIN = 40;
const int SPACE = 35;
auto label = Label::createWithTTF("SocketIO Extension Test", "fonts/arial.ttf", 28);
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
label->setPosition(Vec2(winSize.width / 2, winSize.height - MARGIN));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
addChild(label, 0);
auto menuRequest = Menu::create();
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
menuRequest->setPosition(Vec2::ZERO);
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
addChild(menuRequest);
// Test to create basic client in the default namespace
auto labelSIOClient = Label::createWithTTF("Open SocketIO Client", "fonts/arial.ttf", 22);
auto itemSIOClient = MenuItemLabel::create(labelSIOClient, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOClientClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemSIOClient->setPosition(Vec2(VisibleRect::left().x + labelSIOClient->getContentSize().width / 2 + 5, winSize.height - MARGIN - SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemSIOClient);
// Test to create a client at the endpoint '/testpoint'
auto labelSIOEndpoint = Label::createWithTTF("Open SocketIO Endpoint", "fonts/arial.ttf", 22);
auto itemSIOEndpoint = MenuItemLabel::create(labelSIOEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuSIOEndpointClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemSIOEndpoint->setPosition(Vec2(VisibleRect::right().x - labelSIOEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemSIOEndpoint);
// Test sending message to default namespace
auto labelTestMessage = Label::createWithTTF("Send Test Message", "fonts/arial.ttf", 22);
auto itemTestMessage = MenuItemLabel::create(labelTestMessage, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemTestMessage->setPosition(Vec2(VisibleRect::left().x + labelTestMessage->getContentSize().width / 2 + 5, winSize.height - MARGIN - 2 * SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemTestMessage);
// Test sending message to the endpoint '/testpoint'
auto labelTestMessageEndpoint = Label::createWithTTF("Test Endpoint Message", "fonts/arial.ttf", 22);
auto itemTestMessageEndpoint = MenuItemLabel::create(labelTestMessageEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestMessageEndpointClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemTestMessageEndpoint->setPosition(Vec2(VisibleRect::right().x - labelTestMessageEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 2 * SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemTestMessageEndpoint);
// Test sending event 'echotest' to default namespace
auto labelTestEvent = Label::createWithTTF("Send Test Event", "fonts/arial.ttf", 22);
auto itemTestEvent = MenuItemLabel::create(labelTestEvent, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemTestEvent->setPosition(Vec2(VisibleRect::left().x + labelTestEvent->getContentSize().width / 2 + 5, winSize.height - MARGIN - 3 * SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemTestEvent);
// Test sending event 'echotest' to the endpoint '/testpoint'
auto labelTestEventEndpoint = Label::createWithTTF("Test Endpoint Event", "fonts/arial.ttf", 22);
auto itemTestEventEndpoint = MenuItemLabel::create(labelTestEventEndpoint, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEventEndpointClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemTestEventEndpoint->setPosition(Vec2(VisibleRect::right().x - labelTestEventEndpoint->getContentSize().width / 2 - 5, winSize.height - MARGIN - 3 * SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemTestEventEndpoint);
// Test disconnecting basic client
auto labelTestClientDisconnect = Label::createWithTTF("Disconnect Socket", "fonts/arial.ttf", 22);
auto itemClientDisconnect = MenuItemLabel::create(labelTestClientDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestClientDisconnectClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemClientDisconnect->setPosition(Vec2(VisibleRect::left().x + labelTestClientDisconnect->getContentSize().width / 2 + 5, winSize.height - MARGIN - 4 * SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemClientDisconnect);
// Test disconnecting the endpoint '/testpoint'
auto labelTestEndpointDisconnect = Label::createWithTTF("Disconnect Endpoint", "fonts/arial.ttf", 22);
auto itemTestEndpointDisconnect = MenuItemLabel::create(labelTestEndpointDisconnect, CC_CALLBACK_1(SocketIOTestLayer::onMenuTestEndpointDisconnectClicked, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemTestEndpointDisconnect->setPosition(Vec2(VisibleRect::right().x - labelTestEndpointDisconnect->getContentSize().width / 2 - 5, winSize.height - MARGIN - 4 * SPACE));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
menuRequest->addChild(itemTestEndpointDisconnect);
// Sahred Status Label
_sioClientStatus = Label::createWithTTF("Not connected...", "fonts/arial.ttf", 14, Size(320, 100), TextHAlignment::LEFT);
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
_sioClientStatus->setAnchorPoint(Vec2(0, 0));
_sioClientStatus->setPosition(Vec2(VisibleRect::left().x, VisibleRect::rightBottom().y));
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
this->addChild(_sioClientStatus);
// Back Menu
auto itemBack = MenuItemFont::create("Back", CC_CALLBACK_1(SocketIOTestLayer::toExtensionsMainLayer, this));
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
itemBack->setPosition(Vec2(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
auto menuBack = Menu::create(itemBack, NULL);
Squashed commit of the following: commit a9572b8913f3a38b59adbd7b4017ab9848a6b2b5 Author: Ricardo Quesada <ricardoquesada@gmail.com> Date: Wed May 14 10:03:44 2014 -0700 math renames `Vector2` -> `Vec2` `Vector3` -> `Vec3` `Vector4` -> `Vec4` `Matrix` -> `Mat4` commit 4e107f4bd854c26bfceb52b063d6bd9cea02d6a3 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:24:28 2014 -0700 raw version of rename Vector3 commit 1d115573ebe96a5fc815fa44fbe6417ea7dba841 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:07:14 2014 -0700 rename Vector2 after merge commit ab2ed58c129dbc30a4c0970ed94568c5d271657b Merge: 1978d2d 86fb75a Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 09:05:30 2014 -0700 Merge branch 'v3' into v3_renameMathClassName Conflicts: tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest_Editor.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest_Editor.cpp commit 1978d2d174877172ccddc083020a1bbf43ad3b39 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 08:51:45 2014 -0700 rename vector2 in tests/cpp-empty-test folder commit d4e0ff13dcce62724d2fece656543f26aa28e467 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:58:23 2014 -0700 rename vector2 in tests/cpp-tests cpp files commit be50ca2ec75e0fd32a6fcdaa15fe1ebb4cafe79f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:52:57 2014 -0700 rename vector2 in tests/cpp-tests head files commit 6daef564400d4e28c4ce20859a68e0f583fed125 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:49:48 2014 -0700 rename vector2 in extension folder commit 8f3f0f65ceea92c9e7a0d87ab54e62220c5572e2 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:47:22 2014 -0700 rename vector2 in cocos/2d cpp files commit e1f3105aae06d595661a3030f519f7cc13aefbed Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:44:39 2014 -0700 rename vector2 in cocos/2d head files commit 6708d890bfe486109120c3cd4b9fe5c078b7108f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:59 2014 -0700 rename vector2 in cocos/base folder commit d3978fa5447c31ea2f3ece5469b7e746dfba4248 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:43 2014 -0700 rename vector2 in cocos/deprecated folder commit 4bff45139363d6b9706edbbcf9f322d48b4fd019 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:40:26 2014 -0700 rename vector2 in cocos/editor-support folder commit 353d244c995f8b5d14f635c52aed8bc5e5fc1a6f Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:36:48 2014 -0700 rename vector2 in cocos/ui folder commit 758b8f4d513084b9922d7242e9b8f2c7f316de6c Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:39 2014 -0700 rename vector2 in cocos/renderer folder commit 0bd2710dd8714cecb993880bc37affd9ecb05c27 Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:32:15 2014 -0700 rename vector2 in cocos/physics folder commit b7f0581c4587348bdbc1478d5374c2325735f21d Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:25:01 2014 -0700 rename vector2 in cocos/math folder commit a8631a8e1a4e2740807ccd9be9d70de6ecaad7dd Author: Huabing.Xu <dabingnn@gmail.com> Date: Wed May 14 00:16:55 2014 -0700 rename Vector2 to Vec2 deprecate typedef Vector2
2014-05-15 01:07:09 +08:00
menuBack->setPosition(Vec2::ZERO);
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
addChild(menuBack);
}
SocketIOTestLayer::~SocketIOTestLayer(void)
{
}
//test event callback handlers, these will be registered with socket.io
void SocketIOTestLayer::testevent(SIOClient *client, const std::string& data) {
log("SocketIOTestLayer::testevent called with data: %s", data.c_str());
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
std::stringstream s;
s << client->getTag() << " received event testevent with data: " << data.c_str();
_sioClientStatus->setString(s.str().c_str());
}
void SocketIOTestLayer::echotest(SIOClient *client, const std::string& data) {
log("SocketIOTestLayer::echotest called with data: %s", data.c_str());
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
std::stringstream s;
s << client->getTag() << " received event echotest with data: " << data.c_str();
_sioClientStatus->setString(s.str().c_str());
}
void SocketIOTestLayer::toExtensionsMainLayer(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
ExtensionsTestScene *scene = new ExtensionsTestScene();
scene->runThisTest();
scene->release();
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
if(_sioEndpoint) _sioEndpoint->disconnect();
if(_sioClient) _sioClient->disconnect();
}
void SocketIOTestLayer::onMenuSIOClientClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
//create a client by using this static method, url does not need to contain the protocol
_sioClient = SocketIO::connect("ws://channon.us:3000", *this);
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
//you may set a tag for the client for reference in callbacks
_sioClient->setTag("Test Client");
//register event callbacks using the CC_CALLBACK_2() macro and passing the instance of the target class
_sioClient->on("testevent", CC_CALLBACK_2(SocketIOTestLayer::testevent, this));
_sioClient->on("echotest", CC_CALLBACK_2(SocketIOTestLayer::echotest, this));
}
void SocketIOTestLayer::onMenuSIOEndpointClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
//repeat the same connection steps for the namespace "testpoint"
_sioEndpoint = SocketIO::connect("ws://channon.us:3000/testpoint", *this);
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
//a tag to differentiate in shared callbacks
_sioEndpoint->setTag("Test Endpoint");
//demonstrating how callbacks can be shared within a delegate
_sioEndpoint->on("testevent", CC_CALLBACK_2(SocketIOTestLayer::testevent, this));
_sioEndpoint->on("echotest", CC_CALLBACK_2(SocketIOTestLayer::echotest, this));
}
void SocketIOTestLayer::onMenuTestMessageClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
//check that the socket is != NULL before sending or emitting events
//the client should be NULL either before initialization and connection or after disconnect
if(_sioClient != NULL) _sioClient->send("Hello Socket.IO!");
}
void SocketIOTestLayer::onMenuTestMessageEndpointClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
if(_sioEndpoint != NULL) _sioEndpoint->send("Hello Socket.IO!");
}
void SocketIOTestLayer::onMenuTestEventClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
//check that the socket is != NULL before sending or emitting events
//the client should be NULL either before initialization and connection or after disconnect
if(_sioClient != NULL) _sioClient->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]");
}
void SocketIOTestLayer::onMenuTestEventEndpointClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
if(_sioEndpoint != NULL) _sioEndpoint->emit("echotest","[{\"name\":\"myname\",\"type\":\"mytype\"}]");
}
void SocketIOTestLayer::onMenuTestClientDisconnectClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
if(_sioClient != NULL) _sioClient->disconnect();
}
void SocketIOTestLayer::onMenuTestEndpointDisconnectClicked(cocos2d::Ref *sender)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
if(_sioEndpoint != NULL) _sioEndpoint->disconnect();
}
// Delegate methods
void SocketIOTestLayer::onConnect(network::SIOClient* client)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
log("SocketIOTestLayer::onConnect called");
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
std::stringstream s;
s << client->getTag() << " connected!";
_sioClientStatus->setString(s.str().c_str());
}
void SocketIOTestLayer::onMessage(network::SIOClient* client, const std::string& data)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
log("SocketIOTestLayer::onMessage received: %s", data.c_str());
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
std::stringstream s;
s << client->getTag() << " received message with content: " << data.c_str();
_sioClientStatus->setString(s.str().c_str());
}
void SocketIOTestLayer::onClose(network::SIOClient* client)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
log("SocketIOTestLayer::onClose called");
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
std::stringstream s;
s << client->getTag() << " closed!";
_sioClientStatus->setString(s.str().c_str());
//set the local pointer to NULL or connect to another client
//the client object will be released on its own after this method completes
if(client == _sioClient) {
_sioClient = NULL;
} else if(client == _sioEndpoint) {
_sioEndpoint = NULL;
}
}
void SocketIOTestLayer::onError(network::SIOClient* client, const std::string& data)
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
{
log("SocketIOTestLayer::onError received: %s", data.c_str());
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
std::stringstream s;
s << client->getTag() << " received error with content: " << data.c_str();
_sioClientStatus->setString(s.str().c_str());
}
void runSocketIOTest()
{
auto scene = Scene::create();
auto layer = new SocketIOTestLayer();
scene->addChild(layer);
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
Director::getInstance()->replaceScene(scene);
layer->release();
Implements a socket.io client extension, adds a test case and updates the android makefiles. Contains the following tasks: -initial socket.io extension commit -sioclientimpl subclasses websocket:delegate to respond to websocket events -implement static connect methods and basic client creation -move SocketIO class files into correct extension folder (network) -create SocketIO test in TestCpp -update project references -add missing static modifier to connect method -implement basic test methods -update extensions tests with SocketIO test entry -implement basic handshake and opensocket methods for SocketIO -add Delegate class to handle callbacks, implement virtual Delegate methods in test -implement socket and client registries for lookup when connecting to hosts and endpoints -connect delegate onOpen method by separating impl creation from connection -update test to demonstrate onOpen callback -create send and emit methods, move SIOClient into header file, add send and emit methods to test -implement basic socket.io message parsing -improve logging for events and messages -add logic to pull event name from payload -schedule heartbeat to keep connection alive, scheduled for 90% of the heartbeat interval from the server for safety -add onConnect handler to to catch socket.io onconnect vs websocket onopen -add disconnect and disconnectFromEndpoint methods to properly disconnect and destroy objects -modify SIOClientImpl to track _uri for easier lookup in registries -connect handler for onMessage to message event from socket.io, modify onError handler to take a string instead of WebSocket error code -create SIOEvent callback type, implement event registry in clients, add test for event registration and callback -update SIOEvent to use std::function and c++11, utilize cocos2d CC_CALLBACK method to bind selectors, this ensures that the *this reference is properly passed -check for connect before sending or emitting in the client, cleanup some codes -change connect logic to reuse existing socket connections instead of opening a new one -implements get and set Tag methods for clients for easy reference -improve endpoint handling, add endpoint tests to test layer -additional error handling within socket disconnect error and failure to open connection -fixes extracting endpoint from socket.io messages (in cases of the connect message, where there is 1 less colon for the connect message to the default namespace). Also fixes connecting to the default namespace "/" in the connectToEndpoint method -add disconnect and onClose handlers to client so that onClose is called in the delegate -add disconnect test methods to test layers -change c-style casts to static_casts when using a CCDICT_FOREACH -remove some unneeded namespace completion -add usage documentation -add handling for disconnect from server, cleanup some codes -update comments and documentation in the socketiotest -update includes so the NDK doesn't complain when compiling with c++11 -add socketio.cpp and test.cpp to the android makefiles -update test URL to my public server, test script can also be found in my repo at https://github.com/hannon235/socket.io-testserver.git Signed-off-by: Chris Hannon <himynameschris@gmail.com>
2013-06-26 10:40:01 +08:00
}