Isomorphic app support
ben-av opened this issue · 3 comments
ben-av commented
Anyone had success using the provider on Isomorphic app?
I'm getting window is not defined error on the server side rendering
WebSocket: window.WebSocket,
^
ReferenceError: window is not defined
cpunion commented
This library just wrap the ActionCable library, and ActionCable depends window.WebSocket
. So just find how to use ActionCalbe/WebSocket in an Isomorphic app. I didn't use WebSocket in SSR, after searching some keywords I'm not found some solutions directly. I think maybe just make a polyfill of server side WebSocket, if you have an tiny example I can try it.
cpunion commented
https://github.com/cpunion/react-actioncable-ssr-example
Wrote a SSR example that used react-actioncable-provider, It works.