0

I'm developing a Progressive Web App which uses a .manifest file to cache all files on the client. I modified the socket.io chat example which is found here:

https://github.com/socketio/chat-example

my modifications can be found here:

https://github.com/TennisVisuals/socket.io.manifest.errors

The first change in the client code is:

  • external resources (jquery and socket.io client libraries) are accessed locally rather than via remote URLs.

Everything works as expected.

But with the second change:

  • <html> is replaced with <html manifest="index.manifest">

The application fails, giving this error in the Javascript console:

http://localhost:3000/socket.io/?EIO=3&transport=polling&t=Lij1LRo net::ERR_FAILED

Initial Fix

I've been able to make it work locally by adding the following lines:

enter var connectionOptions =  {
   "force new connection" : true,
   "reconnectionAttempts": "Infinity",
   "timeout" : 10000,
};
var socket = io(connectionOptions);

Cloudflare and Nginx

But I'm now seeing stranger behavior when I run with Cloudflare and Nginx.

Without the manifest declaration I get an error, but everything still works!

socket.io-1.7.2.js:7370 WebSocket connection to 'wss://hiveeye.net/socket.io/?EIO=3&transport=websocket&sid=rM2LKvCGJwaFx7RrAAAf' failed: Error during WebSocket handshake: Unexpected response code: 400

after adding the manifest declaration it works exactly once and then fails with the following errors:

socket.io-1.7.2.js:4948 GET https://hiveeye.net/socket.io/?EIO=3&transport=polling&t=Lik5SC5&sid=rM2LKvCGJwaFx7RrAAAf net::ERR_FAILED
GET https://hiveeye.net/socket.io/?EIO=3&transport=polling&t=Lik5STN net::ERR_FAILED
GET https://hiveeye.net/socket.io/?EIO=3&transport=polling&t=Lik5STN net::ERR_FAILED

I suspect that if I can get the initial error to go away when running without the manifest, that may do the trick... but I've been unable to find anything to help me resolve that issue...

TennisVisuals
  • 427
  • 5
  • 8

1 Answers1

0

Ok, this was really simple once I found out how to ask the right question

Adding:

NETWORK:
*

at the bottom of the manifest file made everything work.

Yes, the "Application Cache" is deprecated: https://developer.mozilla.org/en-US/docs/Web/HTML/Using_the_application_cache

but I still wanted to make it work!!

TennisVisuals
  • 427
  • 5
  • 8