I want to implement a website that has different types of users. I want that when a user posts something, the admin will be notified automatically. I have read about WebSockets and found some examples but mostly of them are about chat application. I just want a notification update. I just want to have a simple one.

Hope you can help me with this.

Recommended Answers

All 5 Replies

Member Avatar for diafol

Websockets can certainly do that or you could use a Comet server (push). However Comet has its cons. Meteor may be a solution http://meteorserver.org/ but not striclty php.

socket.io has some nice examples too. If I were to implement something like push notifications, I would probably start experimenting with this.

Push notifications are very similar to what goes on in chat apps, so the faact that you see those as the main examles is not surprising.

I really don't have any idea how to implement that one. My main problem is the connection between the admin and a normal user. I want a specific client to be updated as well whenever the admin updates something. I don't want all the logged in user to be notified.

I have read about Comet too but I don't know how to implement it.

Member Avatar for diafol

Comet does look pretty fiddly to set up. I once tried to implement it from the APE site, but I failed miserably. I'd have a little play with the socket.io version and see how far you get. Then when you hit the wall with regard to user access come back. I'm sure that other people have tried what you're trying and there will be forums and tutorials online. I haven't seaarched for them, but i'd be very very surprised if there aren't any.

I've not been able to find much on socket.io and PHP, so perhaps wesockets would be better:

http://www.websocket.org/demos.html

If you want real help, rather than some opinions on how to approach the problem, then post your code here!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.