Closed codeanticode closed 3 years ago
This other tutorial seems quite straightforward (Node+React, no Flask though):
https://medium.com/swlh/build-a-real-time-chat-app-with-react-hooks-and-socket-io-4859c9afecb0
Source code: https://github.com/pixochi/socket.io-react-hooks-chat
I was able to incorporate their components into the chat-test branch :-)
Getting an No 'Access-Control-Allow-Origin' error Fixed with https://github.com/codeanticode/oasis-server/commit/6cfadb35bd8b495c9b1085e6a7c4a78fcec34a6b, https://github.com/codeanticode/oasis-server/commit/2527be1693fe50d9d011b6547abf217432543d0b, and https://github.com/codeanticode/oasis-server/commit/d6b7d77dc9d5e9c38d36e0c74ab93cd6bc8cc59d (Flask development server is not compatible with socketio as discussed here)
Very important: When using gunicorn as web server, one must specify eventlet or gevent workers, otherwise the socketio events will not be handled by the app, see deployment details:
Features of the chat system:
Some resources
Beware of version incompatibilities between python-socketio (server) and socket.io-client:
https://github.com/miguelgrinberg/python-socketio/issues/578
About not receiving messages from client:
https://github.com/miguelgrinberg/Flask-SocketIO/issues/1038
Security considerations:
https://stackoverflow.com/a/59543084
Push notifications in React:
https://itnext.io/react-push-notifications-with-hooks-d293d36f4836
To allow communication between registered users (artists/hosts/visitors). Some resources:
https://www.twilio.com/blog/multi-room-web-chat-flask-react-twilio-conversations
https://medium.com/analytics-vidhya/simple-chat-app-with-react-flask-b2ae72404fcb
https://github.com/etmoore/socketio-flask-react-chat
https://chaewonkong.github.io/posts/socket-io.html