Our project includes a react native client and a node.js server. I was wondering if it'd be efficient to use socket.io for our search feature in order for the server to return a live feed for every letter that's typed on the client.
Asked
Active
Viewed 145 times
1
-
2Just a simple AJAX request would suffice. Websockets are meant for pushing data from server to client without a request being made. Since your user types in the searchbox, you can fire a request on each keystroke. – nicholaswmin Sep 02 '19 at 16:50
-
1@Mojaddam consider enabling [HTTP keep-alive](https://www.imperva.com/learn/performance/http-keep-alive/) before going the socket.io route. But also be wary that high traffic sites often [disable keep-alive](https://stackoverflow.com/questions/12568376/http-keep-alive-benefits-on-ajax-site), and I don't doubt this could potentially be the same reason why you should opt against using a live connection (such as websockets) to speed up search. – Sal Rahman Sep 02 '19 at 16:56