ofxLibwebsockets file size limit

I’m having trouble loading big files served by @robotconscience’s ofxLibwebsockets.

On chrome

GET http://localhost:9092/js/main.js net::ERR_CONTENT_LENGTH_MISMATCH

On Firefox:

The connection to ws://localhost:9092/ was interrupted while the page was loading.

On Safari:

Failed to load resource: The network connection was lost.  http://localhost:9092/js/main.js

In Chrome Version 42.0.2311.90 (64-bit) it seems the limit file size is 552.960 bytes. Other browsers is much bigger.

Everytime in a while it will just load just fine.

You can test it by replacing main.js on example_server_echo by this file (2.2MB) it doesn’t do anything, but it should output LCSocket::connected(1) if succeeded


Hey @xavivives sorry for the delay!

The webserver built into libwebsockets is pretty minimal, and isn’t a core feature we’re supporting. I believe they just implemented multi-part serving for large files, but haven’t looked into it a ton.

Are you interested in looking more into their server? I get the appeal of having both the ws and http server run out of your app, I just haven’t found lws’ server to be super extensible/useful so I don’t use it! It’d be awesome if you can try to crack that open; for now open an issue on Git and I’ll try to check it out in the near future.

– Brett

If you’re trying to build production servers with all the bells and whistles and websocket support, check out ofxHTTP.

Thanks guys!

It seems to be a [know issue][1] with an [easy fix][2]. ^^
I haven’t tried as I’ve been unable to compile libwebsockets.
When I call make on the command line I get a bunch of errors like this:

    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdlib.h:138:49: error: 
          expected parameter declarator
    void    *bsearch(const void *, const void *, size_t,
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/stdlib.h:139:12: error: 
          expected parameter declarator
                size_t, int (*)(const void *, const void *));

It seems a problem specific to my machine but I’ve been digging for hours with no results.
[1]: https://github.com/warmcat/libwebsockets/issues/125
[2]: https://github.com/SDSGlen/libwebsockets/commit/1e0d5a80286f0227d1fb6f171b831b2813a719f5

What’s up 2015?!! FWIW I sidestepped this issue by using the very nice little HTTP library cpp-httplib. It sucks having to use another library when one is built in, but as xavivives said, the alternative is slogging through recompiling libwebsockets.