Skip to content

Duplicate events #997

@smileart

Description

@smileart

Here I create primitive example of server with socket.io with such stuff:

  • socket.io > 0.9.9
├─┬ socket.io@0.9.9
│ ├── policyfile@0.0.4
│ ├─┬ redis@0.7.2
│ │ └── hiredis@0.1.14
│ └─┬ socket.io-client@0.9.9
│   ├─┬ active-x-obfuscator@0.0.1
│   │ └── zeparser@0.0.5
│   ├── uglify-js@1.2.5
│   ├─┬ ws@0.4.21
│   │ ├── commander@0.6.1
│   │ ├── options@0.0.3
│   │ └── tinycolor@0.0.1
│   └── xmlhttprequest@1.4.2
└──────────────────── ●

on x86_64 Linux:

Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise
Kernel: 3.2.0-29-generic
GCC version: 4.6 (x86_64-linux-gnu)

var io = require('socket.io').listen(1717);

io.sockets.on('connection', function (socket) {
  socket.on('ping', function (data){
      console.log(data);
  });

  socket.on('message', function(data){
      console.log(data);
  });
});

And PHP-client like this:

#!/usr/bin/php -q

<?php
error_reporting(E_ALL);
require(dirname(__FILE__).'ElephantIO/Client.php');

$elephant = new ElephantIO\Client('http://localhost:1717');
$elephant->init(false);

$elephant->emit('ping', array('test' => 'Hello World!'), '');
// $elephant->send(ElephantIO\Client::TYPE_MESSAGE, null, null, 'Hello World!');

Here is the log of that server:

   info  - socket.io started
   debug - client authorized
   info  - handshake authorized KAZbMECxcHQBIgTXynHr
   debug - setting request GET /socket.io/1/websocket/KAZbMECxcHQBIgTXynHr
   debug - set heartbeat interval for client KAZbMECxcHQBIgTXynHr
   debug - client authorized for 
   debug - websocket writing 1::
   debug - websocket received data packet 1:::
   debug - websocket writing 1::
   debug - websocket received data packet 3:::Hello World!
Hello World! 
Hello World!

So, every time php-client sends one message or emits event, it's duplicated on the server side :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions