<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/4.2.2">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#ffffff">
On jue, 2014-06-26 at 18:00 +0200, Andreas Grapentin wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
Hi,<BR>
</BLOCKQUOTE>
<BR>
Hi there Andreas,<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
first of all, thank you very much for giving the world a decent WebSockets library in C. That made my life so much easier!<BR>
</BLOCKQUOTE>
<BR>
;-) Thank you very much for your words. That means a lot to us! A twitter pat won't hurt @aspl_es :-)<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Unfortunately though, there seems to be a glitch where after a couple of seconds of continuous runtime a frame arrives at my program, where<BR>
<BR>
nopoll_msg_get_payload(msg); // returns an empty string<BR>
nopoll_msg_get_payload_size(msg); // returns 1<BR>
</BLOCKQUOTE>
<BR>
Interesting.... so calling to strlen over the result reported by nopoll_msg_get_payload reports 0 or 1?<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
in my callback.<BR>
<BR>
If I choose to silently ignore this event, then the following frames are corrupted, reporting invalid data.<BR>
</BLOCKQUOTE>
<BR>
Uhmn.... so something gets tangled there :-?<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
This usually happens only when my app is on very high traffic, and has run for about a minute.<BR>
<BR>
Can you help me find out what's going wrong, or point me in the right direction where to look?<BR>
</BLOCKQUOTE>
<BR>
Don't know... yet ;-). We have it working for several public available products and nothing similar has been reported...<BR>
...and one of them is very traffic intense (Core-Admin).<BR>
<BR>
You can try the following:<BR>
<BR>
1) In the case you are using a browser, try to upgrade it. WebSocket is a fairly young protocol. We have found<BR>
various issues with some browsers that got fixed after upgrading them.<BR>
<BR>
2) You can also have the latest noPoll version from the svn. It is stable and should be released soon and the next stable release:<BR>
<BR>
<A HREF="https://dolphin.aspl.es/svn/publico/nopoll//trunk/">https://dolphin.aspl.es/svn/publico/nopoll//trunk/</A><BR>
<BR>
3) You can also try running your server with logs enabled and send us log traces. For that you can<BR>
start your server with something like this (assuming you are running Linux/Unix version):<BR>
<BR>
>> NOPOLL_DEBUG=1 ./your-server-app<BR>
<BR>
...and if you are running on windows, you can use a combination of nopoll_log_enable and nopoll_log_set_handler<BR>
to capture the log.<BR>
<BR>
4) If it doesn't work, please, let us know which browser/client side software are you using. If would be really great<BR>
to have a working example that reproduces the problem...<BR>
<BR>
In any case, please let us know your progress to find out if this is something specific to noPoll or maybe a browser/client side...<BR>
<BR>
Best Regards,<BR>
<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
Thank you, and kind Regards,<BR>
Andreas<BR>
<BR>
<BR>
Below is my main function, and my callback:<BR>
<BR>
void<BR>
botframe_callback (noPollCtx *ctx, noPollConn *conn, noPollMsg *msg, noPollPtr *user_data)<BR>
{<BR>
if (nopoll_msg_is_fragment(msg))<BR>
{<BR>
printf("oh, I got a fragment!\n");<BR>
return;<BR>
}<BR>
<BR>
char *message = nopoll_msg_get_payload(msg);<BR>
unsigned int length = nopoll_msg_get_payload_size(msg);<BR>
<BR>
if (length <= 1)<BR>
{<BR>
printf("that's not a message!\n");<BR>
return;<BR>
}<BR>
<BR>
// after this point, there is a lot of json parsing, and data management<BR>
// somewhere in the middle of it, I send a response:<BR>
<BR>
nopoll_conn_send_text (conn, str, strlen(str));<BR>
<BR>
// and then there is some more stuff, and resource releasing code<BR>
}<BR>
<BR>
<BR>
int<BR>
main (void)<BR>
{<BR>
noPollCtx *ctx = nopoll_ctx_new();<BR>
if (!ctx)<BR>
{<BR>
perror("unable to create websocket context");<BR>
exit(1);<BR>
}<BR>
<BR>
nopoll_ctx_set_on_msg(ctx, (noPollOnMessageHandler)&botframe_callback, NULL);<BR>
<BR>
noPollConn *conn = nopoll_conn_new(ctx, "localhost", "8080", NULL, NULL, NULL, NULL);<BR>
if (!nopoll_conn_is_ok(conn))<BR>
{<BR>
perror("unable to connect to cow server");<BR>
exit(1);<BR>
}<BR>
<BR>
nopoll_loop_wait(ctx, 0);<BR>
<BR>
return 0;<BR>
}
<PRE>
_______________________________________________
noPoll mailing list
<A HREF="mailto:noPoll@lists.aspl.es">noPoll@lists.aspl.es</A>
<A HREF="http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll">http://lists.aspl.es/cgi-bin/mailman/listinfo/nopoll</A>
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>