Skip to content
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

Server issued notifications #93

Open
ikv opened this issue Jun 18, 2018 · 2 comments
Open

Server issued notifications #93

ikv opened this issue Jun 18, 2018 · 2 comments
Assignees
Labels

Comments

@ikv
Copy link

ikv commented Jun 18, 2018

I would like to push some notifications from the server down to the client.
From the looks of it, json-rpc does not supports such use case, or does it?

@pavlov99
Copy link
Owner

Hi, @ikv

This library's main purpose is to provide a protocol implementation and be as much server agnostic as possible. It does support "request-response" functionality via manager and provides optional backends for Django and Flask.

In your case, there is no API request "from outside" as the server sends notifications based on some internal event. That means that you do not need to use a large chunk (80%+) of this library. I would consider two cases:

  1. Use this library to make sure notifications are in a correct JSON-RPC format (regular or batch). The library provides some validation, data manipulation, and serialization mechanisms. Please take a look at JSONRPC20Response.

  2. Skip this library and manually create a JSON-RPC response object. Since it is created on the server side, you know it is in the right format. In this case, you don't need any format validation or exception handling on the server.

Please let me know what you think about it.

@pavlov99 pavlov99 self-assigned this Jun 20, 2018
@ikv
Copy link
Author

ikv commented Jun 20, 2018

In your case, there is no API request "from outside" as the server sends notifications based on some internal event.

This is not the case.
I need to do both: accept external requests and issue notifications.

For example, this protocol requires to push two different events (miming.set_target and mining.notify) after first call to mining.authorize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants