28#ifndef __TestCpp__SocketIOTest__
29#define __TestCpp__SocketIOTest__
32#include "extensions/cocos-ext.h"
33#include "network/SocketIO.h"
39 ,
public cocos2d::network::SocketIO::SIODelegate
50 virtual void onClose(cocos2d::network::SIOClient* client)
override;
54 virtual void onError(cocos2d::network::SIOClient* client,
const std::string& data)
override;
77 void testevent(cocos2d::network::SIOClient *client,
const std::string& data);
81 void echotest(cocos2d::network::SIOClient *client,
const std::string& data);
85 void connect(cocos2d::network::SIOClient* client,
const std::string& data);
89 void disconnect(cocos2d::network::SIOClient* client,
const std::string& data);
93 void message(cocos2d::network::SIOClient* client,
const std::string& data);
98 void json(cocos2d::network::SIOClient* client,
const std::string& data);
100 virtual std::string
title()
const override{
return "SocketIO Extension Test"; }
DEFINE_TEST_SUITE(SocketIOTests)
void echotest(cocos2d::network::SIOClient *client, const std::string &data)
Socket.io event handler for custom event "echoevent"
void onMenuSIOEndpointClicked(cocos2d::Ref *sender)
cocos2d::network::SIOClient * _sioClient
void onMenuTestEndpointDisconnectClicked(cocos2d::Ref *sender)
cocos2d::Label * _sioClientStatus
void connect(cocos2d::network::SIOClient *client, const std::string &data)
Socket.io event handler for event "connect"
void testevent(cocos2d::network::SIOClient *client, const std::string &data)
Socket.io event handler for custom event "testevent"
void onMenuTestEventClicked(cocos2d::Ref *sender)
void message(cocos2d::network::SIOClient *client, const std::string &data)
Socket.io event handler for event "message"
void closedSocketAction(cocos2d::network::SIOClient *client)
Common function to call on both socket.io disconnect and websocket close
void onMenuTestEventEndpointClicked(cocos2d::Ref *sender)
void onMenuTestClientDisconnectClicked(cocos2d::Ref *sender)
virtual void onError(cocos2d::network::SIOClient *client, const std::string &data) override
Used for network level socket error (not for disconnect from the socket.io server)
virtual std::string title() const override
void onMenuTestMessageEndpointClicked(cocos2d::Ref *sender)
void json(cocos2d::network::SIOClient *client, const std::string &data)
Socket.io event handler for event "json" This is only used in v 0.9.x, in 1.x this is handled as a "m...
void onMenuSIOClientClicked(cocos2d::Ref *sender)
cocos2d::network::SIOClient * _sioEndpoint
virtual void onClose(cocos2d::network::SIOClient *client) override
Used for network level socket close (not for disconnect from the socket.io server)
CREATE_FUNC(SocketIOTest)
void onMenuTestMessageClicked(cocos2d::Ref *sender)
void disconnect(cocos2d::network::SIOClient *client, const std::string &data)
Socket.io event handler for event "disconnect"