I'm currently developing a PHP website and it has a posts+comments system. I also have a socket.io server to have real-time communication through comments to posts (just like facebook). Everything is fine now, except that I send a comment to all connected users. And I'm thinking that when I'll have like 10.000 users and one comments on a post, it sends that comment to all 10.000 users and maybe the connection will crash pretty soon this way.
I think I have to keep the posts a user is viewing. Maybe in PHP, when I show up some posts, I keep in the database their id and it will expire after a period, like an hour. In this case, when somebody comments on a post, I get the users who are seeing that post and send the comment only to them. Is there a cleaner way to accomplish that?
Socket.io has the concepts of Rooms
You could create a different room for each post and have the clients subscribe only to the relevants rooms (posts).
Related
Trying to parse through the Microsoft Documentation of this is a bit of a challenge.
Our use case is that we want the app to receive broadcasts from an external service. On that broadcast we want it to send a personalized message to every person in the team/org.
Is that at all possible? Doing this in Workplace and Slack was fairly straight forward but i'm going nowhere fast with Teams. Connectors seem weird and user-based, not team based, requiring you to set up a config page for it? Bots seem centered around AI interactions and on demand features and general apps? Not sure.
So yea the question is, is it possible. If so i would appreciate to know where to look for how to do this.
Yes, this is definitely possible. If you're wanting to send to a Team (i.e. a Channel within a Team) you can use either a bot or a webhook. If you want to send to individuals or to group chats, then you'd be looking to use a bot.
For webhooks, see Post external requests to Teams with incoming webhooks. For bots you can start here, and in that case you'd want to look into something called "Pro-active messaging", where the bot is sending a message on it's own, rather in response to a user's initial message.
The Pro-active messaging can be a bit tricky, so if you do want to go that approach (1 to 1 messaging), let me know in the comments and I give you some more guidance. However, I'd suggest rather looking at messaging the Team, and creating/using a relevant channel, rather than sending every user a 1-1 message.
Hi I am interested in using Mix Panel on a web site to track customers events. I would like to know if there is any way to use the api to personalise the web site per customer, similar to segmentation for emails.
I would like to query the api for a singular customer asking whether they have achieved several events.
For example something like
If customer has clicked out and last visit greater than a month ago display a banner advert.
Mixpanel does not seem like a correct tool for the job you describe here.
While theoretically this might be possible (via Mixpanel's HTTP API), this will create unnecessary architectural complexity and add extra latency. If you need to customize your web site per user, store any user state in a database like MySQL or PostgreSQL. This will be both faster and easier.
I searched the www for a solution to a problem of mine without finding an answer.
I need to get notificated when my bot in slack goes offline, but I don't know how.
To get notificated when he logs in is cacke, because I can set him to send a message, but when he's off there is no option to send a message.
I prefer PHP, Javascript, but other languages are also fine.
Thank you very much for your effort
There are many options how to setup a way to monitor your bot and get notified when it is offline.
One option that has worked well for me is to use an external website to monitor your bot. That website will send requests to your bot every couple of minutes to see if is is still alive and will notify you if the request fails. You may need to extend your bot a bit, so that he can reply to these requests in a proper way.
There are many website that provide this service. The one I use is uptimerobot, which also happens to be free for up to 50 monitors.
Forewarning, I am very new to Node.js and Socket.io and this probably has a simple answer.
I am using it in conjunction with a PHP app. The intention is to have real-time notifications.
If you take a scenario such as Facebook -- something with lots of users, but the notifications should only be sent out to certain sets of users, how do I target those users?
I've thought of setting something like:
socket.on('notification-[user_id]', function() {...} );
But that would be insane considering thousands of users.
It also seems to be insane to send notifications to thousands of users and have each user have to figure out whether it's for them or not.
Is there a way around this? What am I missing?
I'm new to them too, but i think you can do it like this:
In the client side you can just:
socket.on('notification',function(){...});
In the server side you can use :
io.sockets.connected[socketid].emit('nofification',data);
Hope it can help you~
We are exploring the SMS Premium Voting similar like American Idol/Big Brother etc etc. How does SMS Premium Voting works technically? We are interested in how the data collected as far as I understand the third party company will collect the billing data from each Telco companies. Then it consolidate into a single data mining. Is this the right approach?
Or is it possible to get data from the destination number (the thing is we don't know how does it work so I don't know if this is possible or not).
We are actualy programmer and trying to get this data voting collected centrally or possibly raw data of the SMS but need more information on how does thing works.
I am appreciated your comment or feedback.
Thank you
One way this works is that the company that owns the number (either telco or a third party with agreements with telco companies) have a service set up so that each SMS received results in an HTTP request to a webserver of the cusomer's choice. Simplified "big brother" has a special page on their web site and the telco companies visit that page once for each SMS posting the SMS content. All filtering and calculations are then completed in the code for that page. Naturally you have to makesure that you ignore any requests from unexpected hosts to avoid voting tampering.