Skip to content

Latest commit

 

History

History
executable file
·
45 lines (31 loc) · 572 Bytes

readme.md

File metadata and controls

executable file
·
45 lines (31 loc) · 572 Bytes

poorws.js

This is a very simple WebSocket Client wrapper.

usage

initialization

<script src="js/poorws.js"></script>
var ws = new poorws("SERVER URL");

handle on connection status changed

ws.onStatusChange = function(status){
	$("#status").text(status);
};

send

$("#sendmes").click(function(){
	ws.send("testes");
});

onMessage

ws.onMessage = function(mes){
	var str = JSON.parse(mes.data);
	console.log(str);
};

That's all! Enjoy! :D