Bladeren bron

fixed crash issue with closed sockets

master
mort 8 jaren geleden
bovenliggende
commit
837c13f35a
3 gewijzigde bestanden met toevoegingen van 9 en 2 verwijderingen
  1. 1
    1
      examples/index.html
  2. 7
    0
      index.js
  3. 1
    1
      package.json

+ 1
- 1
examples/index.html Bestand weergeven

@@ -26,7 +26,7 @@
"or typing <code>send</code> in the server's console.";

//Listen to 'myEvent', which the server emits when you
//type 'say' in its console
//type 'send' in its console
sock.on("myEvent", function(data) {
console.log("Received myEvent from server!");
console.log(data);

+ 7
- 0
index.js Bestand weergeven

@@ -40,11 +40,18 @@ var util = require("util");
//Socket {
function Socket(websock) {
this._websock = websock;
this._ready = false;

websock.on("close", function() {
this._ready = false;
this.emit("close");
}.bind(this));

websock.on("ready", function() {
this._ready = true;
this.emit("ready");
});

websock.on("message", function(msg) {
var obj;
try {

+ 1
- 1
package.json Bestand weergeven

@@ -1,6 +1,6 @@
{
"name": "socksugar",
"version": "0.3.0",
"version": "0.3.1",
"description": "Websockets with sugar on top.",
"main": "index.js",
"scripts": {

Laden…
Annuleren
Opslaan