GitHub - fanux/lhttp-javascript-sdk: javascript sdk for quick build a chat room or other IM client (original) (raw)
lhttp_client = new Lhttp("ws://localhost:8081/chat");
lhttp_client.on_open = function(context){ }
lhttp_client.on_message = function(context){ context.send("hello, there!"); }
lhttp_client.on_close = function(context){ }
//set lhttp command
setCommand = function(str) {
}
getCommand = function() {
}
getHeader = function(str) {
}
addHeader = function(key, value) {
}
getBody = function() {
}
//send lhttp body
send = function(body) {
}
//publish a message to a channel
publish = function(channel, command, headers, body) {
}
//subscribe a channel
subscribe = function(channel, command, headers, body) {
}