-
-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watch database table and send updates to React Native app #305
Comments
Hi @madsongr, If I understand your question, when there is a new insertion in a table you want to notify your application, right? What I understand is the following: the only function of PHPSocket.io is to send and receive messages, you need to implement table monitoring from the outside. Suggestions:
I have already applied all of the suggestions above and obtained great results. I hope it helps something. |
Hi, @marcosmarcolin. Yes, you got it. Ok. I thought websocket could watch the db by itself. It's my first time trying to implement it. My client uses a dashboard (reactJS frontend) that creates that data. When my client creates a new item, my php makes the insertion in the backend and sends a push notification to my app (RN app) via PHP after insertion is successfull. Do you think I could implement websocket at this point too? I mean, after insertion. Do you know any example I couild use if the answer is yes? PS: I'm also from SC, BR. hehe |
Hey @madsongr , awesome to see BR here. (: Alright, let's go, I'll suggest something that I've already implemented and it worked well. Just reinforcing, WebSocket is different from Socket.io, even though they do similar things. This project is an implementation of Socket.io from Node.js. If you are depending on WebSocket, check this out: http://socketo.me/. So, here's what I would do:
You can do the same process with WebSocket, only the implementation will change. |
@marcosmarcolin Ok. I've been studying socket.io this week. As far as I noticed I must run a node server along with my php server to make the handshake, right?! If so, I don't know if it's gonna be possible to use it because my client hosting doesn't have node avaliable. Could you clarify this telling me if what I'm saying is correct? |
Hello @madsongr, sorry for the delay. But no, you don't need Node, this repository is for exactly that, to use PHP. What you need is to create a socket.io PHP Server where the clients (front-end) will connect. See an example here: https://github.com/marcosmarcolin/async-php |
I have a RN app that gets data from mysql database. I fetch that data using php and send it to the app in json format.
I'd like to watch a specific table to check if new data is inserted on it so that I can update my list in RN app. Is that possible using phpsocket.io or I should use a node server to do that? I wouldn't like to use node because my client's hosting plan has additional charge over it.
The text was updated successfully, but these errors were encountered: