wss://cloud.achex.ca/<instance>
Achex Cloud Platform. A Secure and configurable networking platform. We handle all your networking needs. We host it, you use it. Use this platform to connect all your devices, mobiles, clients, servers, games, hobbists, machines, etc... together. Request support or custom features on demand.
ws://achex.ca:4010/
The legacy version of Achex server. Test and learn about websockets on this server. Free for everybody. Recommended for beginners and educational purposes. Messages are not encryped for easier debug. Not recommended for professional applications.
Command: | Request / Answer | Description: |
---|---|---|
Authenticate |
{"auth":"<yourID>","passwd":"<yourPass>"}
{"auth":"OK","SID":<your sID#>}
|
|
Join Hub |
{"joinHub":"<hub name>"}
{"joinHub":"Ok"}
|
|
Leave Hub |
{"leaveHub":"<hub name>"}
{"leaveHub":"Ok"}
Hub Notification: {"leftHub":"<hub name>","user":"<username>","sID":<sID#>}
|
|
Send to User |
{"to":"<username>","<var>":"<value>", "...":"...", "...":["...","..."]}
No Feedback Destination receives: {"FROM":"<your username>","sID":<your sID#>,"to":"<username>","<var>":"<value>", "...":"...", "...":["...","..."]}
|
|
Send to Sessions |
{"toS":<session number>,"<var>":"<value>", "...":"...", "...":["...","..."]}
No Feedback Destination receives: {"FROM":"<your username>","sID":<your sID#>,"toS":<session number>,"<var>":"<value>", "...":"...", "...":["...","..."]}
|
|
Send to Hubs |
{"toH":"<hubname>","<var>":"<value>", "...":"...", "...":["...","..."]}
No Feedback Hub Users receive: {"FROM":"<your username>","sID":<your sID#>,"toH":"<hubname>","<var>":"<value>", "...":"...", "...":["...","..."]}
|
|
Request Latency |
{"ping":true}
{"ltcy":<number of milliseconds>}
|
|
Echo |
{"echo":<...>}
{"echo":<...>}
|
|
Plain Text |
Hello World
{"error":"invalid json utf-8"}
|
Command: | Syntax | Description: |
---|---|---|
Achex Websocket |
Achex::ac_webskt myAchexWebsocket(
std::string username,
std::string password,
std::string address = "ws.achex.ca", /* default value */
int port = 443 /* default value */
);
|
|
Connect |
bool connected = myAchexWebsocket.Connect();
|
|
Send MSG |
size_t rc = myAchexWebsocket.send(<std::string/Achex::Message/std::vector>);
|
|
Check if Received MSG |
bool DataWaiting = myAchexWebsocket.hasDataInTimeout(int timeout);
|
|
Get Received Message |
std::shared_ptr<Achex::Message> message = myAchexWebsocket.recv();
|
|
Disconnect |
myAchexWebsocket.Close();
|
Command: | Syntax | Description: |
---|---|---|
Connect |
var ws = new WebSocket('ws://achex.ca:4010');
|
|
Send MSG |
ws.send("<JSON String>");
|
Send JSON objects containing Achex Cloud Commands in order to communicate with the server. you need to follow the Achex Cloud Commands |
Disconnect |
ws.close();
|
|
Event Connection: | ws.onopen = function(evt){
/* connect event */
}; |
|
Event Receive MSG: | ws.onmessage = function(evt){
var received_message = evt.data;
}; |
|
Event Error: | ws.onerror = function(evt) {
console.log(evt);
}; |
|
Event Disconnect: | ws.onclose = function(evt){
alert("Disconnected");
}; |
<!DOCTYPE html>
<html>
<body>
<!-- jQuery / Achex hosted jQuery -->
<script src="http://achex.ca/js/JQ.js"></script>
<!-- Achex jQuery plugin -->
<script src="http://achex.ca/js/jquery.achex.js"></script>
<script>
$.achex({
facebook: false, /* Overwrites username and password with Facebook API login*/
username: 'DemoName@client', /* (native-auth) Achex Native username - set from Panel */
password: 'none', /* (native-auth) Achex Native password - set from Panel*/
url: 'wss://ws.achex.ca', /* (optional) custom server URL to connect to*/
port: 443, /* (optional) custom port*/
reconnect: 3000, /* (optional) Reconnect timeout - set to 'false' to disable */
autoconnect: true, /* (optional) Connect now - set to 'false' to disable */
logo:{ /* Visual Feedback of Achex Cloud Connection Status */
canvas:'achexlogo', /* (optional) Display connection satus in specific canvas ID*/
fade: false, /* (optional) Fade Achex Logo after successful connection */
size: 50 /* (optional) Size of Staus Achex Logo*/
},
opencallback : function(){
/* Triggers on successful connection to Achex Cloud Server */
/* and successful Authentication */
/* Example: */
console.log('Connection Ready');
}
closecallback : function(){
/* Triggers on discconnection from Server */
/* If not called by user and reconnect is enabled, */
/* will to reconnect */
/* Example: */
console.log('Diconnected');
}
callback: function( message_object, raw_message_data, event)
{
/************************************************************************/
/* use "message_object" for quick access to data */
/* in javascript object format */
/* */
/* This function is called only after automatic authentication */
/* and filters out other specific server commands (ping, errors, etc) */
/* This function */
/* */
/* NOTE - internal operation equivalent: */
/* raw_message_data = event.data (raw websocket data) */
/* message_object = JSON.parse(raw_message_data) */
/************************************************************************/
/* Example: */
console.log(message_object);
}
});
$.achex.join('myTestHub'); /* (optional) Join A Hub - sends {joinHub:"myTestHub"} */
$.achex.send(
{
to:'DemoName@client',
someMessage:'hello world'
}
);
</script>
</body>
</html>