receive_messages() ->
receive
Message ->
io:format("~p received ~p", [self(), Message]),
wf:insert_bottom(messages, [#p{}, #span { text=io_lib:format
("~p", [Message]) }])
end,
wf:comet_flush(),
receive_messages().
It is set as the usual way for comet:
wf:comet(fun() -> receive_messages() end)
It receives two messages very quickly:
<0.907.0> received {starting_chat,<0.905.0>}
<0.907.0> received {connected_to,<0.902.0>}
This is what I see in the HTML:
{connected_to, <0.902.0>}
{starting_chat, <0.905.0>}
Somehow, they ended in the reverse order.
I've started adding timer:sleep() calls to this method. With 50
milliseconds, they are in the correct order, with 20 they are not.
When they are in the incorrect order they seem to be always in the
incorrect order, it seems very deterministic.
Any ideas why? Is this a bug? Any ideas what should I do to get them
in the correct order other than sleeping?
You can answer it on Stack Overflow if you want karma:
http://stackoverflow.com/questions/2002487/two-quick-consecutive-calls-to-wfinsertbottom-end-up-in-the-reverse-order
--
You received this message because you are subscribed to the Google Groups "Nitrogen Web Framework for Erlang" group.
To post to this group, send email to nitro...@googlegroups.com.
To unsubscribe from this group, send email to nitrogenweb...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nitrogenweb?hl=en.