Open madsongr opened 2 months ago
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?
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.