-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
client originated messages handling is not supported #1
Comments
I have two approaches in mind:
|
How about: |
(I numbered the suggestions on the previous messages, so it's easier to follow the discussion.) |
Which hooks would the plugin trigger in case the elgg engine is passed to it? (Sorry but I'm relatively new to elgg...) |
// Called by the push server when it receives a client-originated message
elgg_trigger_event('receive', 'message', $message); // Third-party plugins can now register an event handler for the [receive, message]
// event and do what they want with the message.
elgg_register_event_handler('receive', 'message', function($event, $type, $message) {
// Do something with the message. E.g. save it to database:
$chat_message = new ChatMessage();
$chat_message->content = $message->content;
$chat_message->save();
}); |
Looks good. I'll try to incorporate this into my project and use this plugin for communication, If you need help with the work let me know. |
|
In my login flow I want to send the user all of his pending notifications once he connects. I also send a callback ID with each request in order to resolve the correct data in the client and in addition I save the latest callback id in the plugin (by assuming a maximum of one pending request to the server) If I'll have to break this flow It will mean that I have to save to order of messages or keep several callbacks at any given time which I would like to avoid. |
Hi, |
Yes, it is on my TODO list. There aren't currently any clients paying for developing the plugin, so unfortunately it's a quite low priority. I'll however try to get the change in as soon as possible.
You mean the message that tells which other users are online? AFAIK it's not send every message to all users. ...or is it? |
Please try out this branch: https://github.com/juho-jaakkola/elgg-pusher/tree/plugin_hook When the server receives a message from client, it now triggers the Would this help with your use case? |
Client originated messages are currenly sent to all other subscribers which is not very helpful if you want to do something else with the message (for example trigger some server action).
It would be great if they could be handled by an external component or plugin.
The text was updated successfully, but these errors were encountered: