banacorn / socket.io-haskell

socket.io for haskell folks
MIT License
23 stars 5 forks source link

Server stops responding to emit #2

Closed KMahoney closed 10 years ago

KMahoney commented 10 years ago

This is quite difficult to reproduce, but I've managed to do so in both Chrome and Firefox running on a Mac.

Server:

{-# LANGUAGE OverloadedStrings #-}

import Web.SocketIO

main = server 4000 $ do
  on "ping" $ emit "pong" []

Client:

<script src="socket.io.js"></script>
<script>
  var socket = io.connect('http://localhost:4000');

  socket.on('pong', function (data) {
    console.log("pong!!!");
  });

  socket.emit('ping');
</script>

Waiting for

   [debug] 63065498561054461841    Polling
    [debug] 63065498561054461841    Clear Timeout
    [debug] 63065498561054461841    Set Timeout

then typing socket.emit('ping') into the javascript console will not respond with a 'pong' the first time, but will the second time.

KMahoney commented 10 years ago

I couldn't reproduce this on master