ezyfox-server-es6-client
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
ezy-client.js
ezy-clients.js
ezy-configs.js
ezy-constants.js
ezy-data-handlers.js
ezy-entities.js
ezy-event-handlers.js
ezy-event-message-handler.js
ezy-events.js
ezy-managers.js
ezy-setup.js
ezy-sockets.js
ezy-util.js
index.js
package.json

README.md

ezyfox-server-es6-client

javascript emacs 6 client for ezyfox server

Synopsis

javascript emacs 6 client for ezyfox server

Code Example

1. Create ws client

var config = new Ezy.ClientConfig;
config.zoneName = "freechat";
var clients = Ezy.Clients.getInstance();
var client = clients.newDefaultClient(config);

2. Setup ws client*

var setup = client.setup;
setup.addEventHandler(Ezy.EventType.DISCONNECTION, disconnectionHandler);
setup.addDataHandler(Ezy.Command.HANDSHAKE, handshakeHandler);
setup.addDataHandler(Ezy.Command.LOGIN, userLoginHandler);
setup.addDataHandler(Ezy.Command.APP_ACCESS, accessAppHandler);
var setupApp = setup.setupApp("freechat");
setupApp.addDataHandler("1", function(app, data) {
    controller.contactController.handleSuggestedContactsResponse(data);
});

setupApp.addDataHandler("2", function(app, data) {
    controller.contactController.handleAddContactsResponse(data);
});

setupApp.addDataHandler("4", function(app, data) {
    controller.messageController.handleSystemMessageResponse(data);
});

setupApp.addDataHandler("5", function(app, data) {
    controller.contactController.handleContactsResponse(data);
});

setupApp.addDataHandler("6", function(app, data) {
    controller.messageController.handleUserMessageResponse(data);
});

3. Connect to server

client.connect("ws://localhost:2208/ws");