Private Message Notification Socket.io

Hey there stackoverflow! I am developing a community with Laravel3 right now, I am trying to achieve a private Facebook-style messaging.

I did some of the coding, but my friends and I agree so much with adding real-time messages. I did my research, I can’t say I found a good article about it, some of them start with oh you know everything about matrix so lets socketsocketsocketsocketsocketI’m so confused how to start, where to start, what is it, many of them say go with MongoDB never use MySQL again.Dude, what the hell? I use MySQL, I created a good messaging system in Laravel, I want to add a real-time notification!

All I want to do is

  • UserA sends a message to UserB
  • Message added to privmsg table.
  • Sockets or something else that you offer tells the UserB browser there is a +1 new message from UserA
  • UserB sees that there is one unread message without refreshing the page and click to read it.

How can i achieve this? Is socket.io the best choice for this? if so, how can I use it? any fragments would be so wonderful! or a tutorial about my situation :)

I would be very grateful

+5
source share
1 answer

You suffer from the problem of thinking, "X is always better than Y, so always use X." Probably a name for him ... maybe even a book or two written. Who knows. Start with the first question:

, , : " MongoDB, MySQL ". , ?

, . MySQL MongoDB - . . MySQL ( , SQL... , , ), , . . .

MongoDB - , "NoSQL" ( not-only-SQL). "" , . . "". ... . , , , , , . ( !).

, , , MySQL MongoDB - , . , , , .

, , : UserA UserB; , privmsg.; - , , UserB, +1 UserA; UserB , , .

. , - . Socket.IO . , -, Node.js - ( !). : , - ( ), . . emit , . .

Socket.IO - . . Socket.IO - , . , .

, - . :

  • /
  • , , , .
  • Socket.IO

? Socket.IO : http://socket.io/

+10

All Articles