Commit Graph

16 Commits

Author SHA1 Message Date
Chris Hannon 126ebb888c 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-07-11 17:41:42 -04:00
Ricardo Quesada 4204e8243c TestCpp for iOS uses libcocos2dx, libCocosDenshion, etc...
...as dependencies, and other minor fixes
2013-06-24 16:59:00 -07:00
James Chen dcaa55e622 Warning fixes for TestCpp. Using lambda, CC_CALLBACK_1 and clone pattern. 2013-06-21 14:15:20 +08:00
James Chen 1fb9f44d15 issue #2129: Removing CC prefix for samples module. 2013-06-20 14:17:10 +08:00
James Chen c0d44cb2e4 fixed #2129: Rename m_iVar to _var, remove CC prefixes. 2013-06-15 14:03:30 +08:00
Ricardo Quesada 8a6d33a212 Adds CC prefix to CALLBACK()
Now it is called: CC_CALLBACK()
2013-06-13 20:36:43 -07:00
Ricardo Quesada 83b43ab93e Adds CALLBACK_0, CALLBACK_1 and CALLBACK_2
Handy macros for callbacks.
Instead of:
	std::bind(func_ptr, instnace, std::placeholder::_1)
you use:
	CALLBACK_1(func_ptr, instance)

And also removes more warnings from the tests
2013-06-11 16:30:05 -07:00
Ricardo Quesada 022dfc0acc CPP Tests migrated to the new C++11 API
Many tests were converted to the C++11 API
and some tests were also simplified by using the "CL" macro
instead of the "CF" macro.
2013-06-07 17:21:11 -07:00
James Chen 0ca86db0ff fixed #1647: Renaming enumerations to Cocos2d-x style. ERROR and ERROR_TIMEOUT is defined as macros on Windows, fuck it. 2013-06-03 10:12:55 +08:00
James Chen 8e15cdf5fd WS_ERROR -> ERROR, WS_STATE -> STATE. 2013-06-01 19:51:10 +08:00
James Chen 05a88c89dc fixed #1647: Adding WebSocket support for Cpp and JSB. 2013-05-31 23:13:03 +08:00
James Chen 912905054e fixed #2123: Refactoring network extension, fixing unlikely memory leaks, adding PUT/DELETE methods.
Merge branch 'curl_raii' of https://github.com/sergey-shambir/cocos2d-x into sergey-shambir-curl_raii

Conflicts:
	extensions/network/HttpClient.cpp
	samples/Cpp/TestCpp/Classes/ExtensionsTest/NetworkTest/HttpClientTest.cpp
2013-05-07 15:37:25 +08:00
James Chen 140927494a Updating http test url, removing www prefix. 2013-05-07 15:13:55 +08:00
Hojin Choi 8b9644150d Changes samples' function prototypes to apply newly introduced callback type. 2013-04-28 23:42:31 +09:00
Sergey Shambir 8507f7a386 network: Added PUT and DELETE request types 2013-04-21 20:54:52 +04:00
James Chen 4660e72eda issue #1603: Moved the position of some projects. 2012-12-20 12:58:21 +08:00