cpunion/react-actioncable-provider

Isomorphic app support

ben-av opened this issue · 3 comments

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

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.

https://github.com/cpunion/react-actioncable-ssr-example

Wrote a SSR example that used react-actioncable-provider, It works.

Thanks @cpunion, ended up using the ActionCable client directly