bgreenawald / bananagrams

1 stars 0 forks source link

Refactor Front-end part ii: Add state management #60

Open JocelynYH opened 3 years ago

JocelynYH commented 3 years ago
JocelynYH commented 3 years ago

@bgreenawald question - how can the frontend determine whether or not a particular socket request went through? Because the request doesn't directly correspond with a response - instead there's a separate listener receiving all the socket events.

My concern is, what if somehow - requests aren't making it to the server - there would be no error shown.

bgreenawald commented 3 years ago

From experience, I know it will throw an error if it tries to unsuccessfully connect. I forget which one but it'll be a standard "Not found" error. Looking around, if seems like there are also more formal ways to address this (https://stackoverflow.com/questions/16518153/get-connection-status-on-socket-io-client#:~:text=You%20can%20check%20the%20socket,connect()%3B%20console.)

JocelynYH commented 3 years ago

Awesome okay good to know - thank you for the link! Hmm, that safeguard is a good idea