If I have a signalR hub that sends messages to all clients with a fairly large payload or private information, do all clients that connect into the hub (part of the same group) receive the messages even though they don't subscribe to those events on the client side?
Wondering if the client is smart enough to negotiate what events it has to the server so the server doesn't send extraneous data?
Thanks!
Yes they do. If a client is subscribed to a hub it will receive all messages sent through that hub's broadcasting channels.
There is no way to prevent the client from getting a message other than sending to a specific group that does not include the client or sending to another client specifically.
Some examples:
Clients.All.foo(); // All subscribed clients will foo invoked
Clients.Group("bar").foo(); // All subscribed clients to the hubs group "Bar" will have foo invoked. If your client is not subscribed to "bar" it will not have "foo" invoked.
Clients.Client("AClientsConnectionId").foo(); // The client with the specified connection id will have foo invoked.
Related
I am using RabbitMQ as message broker. I want the messages from the queue to the consumer are sent by the Http POST method.
What I want is that when a message (body of the post formatted in JSON) is ready in the queue, it is sent to the consumer through HTPP post instead of AMQP.
Are there any plugins or something else?
I searched, but I only found HTTP API to publish a message, to manage the queues and to send GET req to the queues (but I do not want to do this).
Thanks
I need "normal" push notifications for my mobile chat users, as is expected of any chat today.
I read the guide on MUC/SUB an implemented my rooms that way, so my clients are subscribed to room messages.
mod_muc rooms are configured as peristent and allow_subscriptions... and working as expected, clients receive messages when online without needing to join room.
I enabled mod_push to catch messages intended for offline users
I am using my own XMPP component "AppServer" to handle offline messages (a fork of: https://git.happy-dev.fr/startinblox/prosody/xmpp-notification-component)
Clients subscibe to push notifications on my AppServer (using IQ-set-enable stanza as described in XEP-0357)
My AppServer correctly receives messages that are sent directly to the full JID of a subscribed and offline user, as expected. So i guess i have in general understood implemented and configured the appServer component correctly.
(however i dont know why a full JID is required)
My AppServer however does not receive messages that are sent to MUC rooms for users that are subscribed to both muc and push and offline.
What am i missing? Am i correct in understanding that MUC/SUB should support mod_push out of the box?
Why are my MUC messages not being pushed to subscribed users?
Why do i need full JID with resource for push notifications to work?
(Using ejabberd 20.4.0)
My AppServer correctly receives messages that are sent directly to the full JID of a subscribed and offline user, as expected. So i guess i have in general understood implemented and configured the appServer component correctly. (however i dont know why a full JID is required)
I have a doubt about the concepts here.
When an account is registered, it has as bare JID: user1#localhost
When a client starts a XMPP session with resource "tka" in that account, the full JID is: user1#localhost/tka
If an account (user1#localhost) doesn't have any online session (no client is connected with no resource), then the concept of "full jid" doesn't make sense:
When no client is connected, what resource do you send the message to?
My AppServer however does not receive messages that are sent to MUC rooms for users that are subscribed to both muc and push and offline.
When an account is subscribed using MUCSUB to messages in a room, and that account has no sessions, and a message is sent to the room... then MUCSUB sends an offline message to that user, and I imagine that should trigger a Push.
Can you check if the offline message is really stored for that account in the "offline" table in your database?
Hi can I make push notification service with signalR?
for example when user start the app,app can recive message and if app closed again app can recive messgae from servers or clients
Until you can send the message to clients that user is online.
And with the closure of the app, Disconnect Communication server with the client. And the ability to send any message disappears.
If you want to send notification after app closed, It is better to use the google service. (e.g: Firebase Cloud Messaging (FCM) services),
Otherwise you can only use signalR for send message in your app.
I hope this is useful description.
If you want the ability to send messages or have messages available to any client then store them in a database table. When they are connected, you can send those messages to them. When they are disconnected they would stay in the database.
You can control flagging messages as read after they are delivered and then deleting them from the database.
Your "push notification" is just querying for the messages when a client is connected.
I am using Google Channel to do Push notification from server. It's working fine, but when I open the debugger windows, I can see lot of polling request that are going to the server.
Is that the way push notification works? If yes, then what is the use of it?
var token ="<%token%>";// This will creaete unique identifier(some id created by google api + ur key)
channel = new goog.appengine.Channel(token);
socket = channel.open();
socket.onopen = function() {
$('#messages').append('<p>Connected!</p>');
};
Thanks.
GCM doesn't do that. Gonna refer to the official docs on it's flow.
Lifecycle Flow
Send and receive downstream messages.
Send a message. The app server sends messages to the client app:
The app server sends a message to GCM connection servers.
The GCM connection server enqueues and stores the message if the device is offline.
When the device is online, the GCM connection server sends the message to the device.
On the device, the client app receives the message according to the platform-specific implementation. See your platform-specific documentation for details.
Receive a message. A client app receives a message from a GCM connection server.
Also announced in the recent I/O 2016, GCM's successor is now Firebase Cloud Messaging, which not only has the Push Notification Service, but also has other features (one example is Analytics) for free.
So overall, using GCM (or FCM) is a simpler method than polling. It handles the queuing of the messages you sent, and some others.
Part of my answer here. Also includes an idea why Polling is not ideal when sending push notifications.
I want to send message from Amazon Simple Notification Service(SNS) to the http endpoint. There is no proper solid documentation on how to do that. Though I had read Amazon SNS documentation still I could not get entire picture.
Can anyone give me simple example on how Amazon SNS and http endpoint work together?
There good documentation for what you asking: http://docs.aws.amazon.com/sns/latest/dg/sns-dg.pdf
Look at the page #147, it describes what steps you need to do for sending messages to HTTP(s) endpoint.
Also check this example which describes how to create topic, subscribe endpoint, confirm subscription and start to receive notification messages from SNS (uses Java SDK): https://github.com/mfine/AmazonSNSExample
General picture is:
On the publisher side:
create topic and subscribe some endpoint to receive messages. After subscribing endpoint to topic, the endpoint will receive SubscriptionConfirmation message.
start publish to topic so your endpoints will receive notification messages
On the subscriber side (your endpoint should be able to handle at least confirm subscription request and notification messages):
confirm subscription: make HTTP GET request to the "SubscribeURL" URL which comes inside the body of the confirm subscription request. Before you confirm subscription your endpoint will not receive any messages from SNS
receive notification messages and do what you want