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

Support for SocketIO and realtime document and event listeners #2

Open
nikkothari22 opened this issue Jul 6, 2022 · 5 comments
Open
Labels
enhancement New feature or request

Comments

@nikkothari22
Copy link
Member

Is your feature request related to a problem? Please describe.
Since Frappe supports realtime socket communication via SocketIO, we can add support for the same.

Describe the solution you'd like
We need the following:

  1. Ability to set SocketIO port in FrappeApp2.
  2. Ability to start a listener, execute a custom callback function and stop the listener. This would be similar to Firebase Realtime listeners (onSnapshot), but can be run on any type of event that's triggered from the backend.
  3. Ability to "listen" to documents (coupled with getDoc) or queries (lists - coupled with getDocList). This would allow developers to always get the latest value from the database whenever the socket event is fired. We can even give the ability to listen to a different event (instead of update_doc) and fetch the latest value.
@nikkothari22 nikkothari22 added the enhancement New feature or request label Jul 6, 2022
@tespheakdeyesoftix
Copy link

This is very nice feature. Hope this will available soon

@Rathana-bit
Copy link

I'm looking forward to seeing it, Hope it will be released soon.

@guinanlin
Copy link

first of alll , tks for your big effort on frappe-js-sdk,

I have also tried to build it myself and consulted with @build With Hussain. The suggestion given was to integrate with frappe-ui. However, when it comes to integrating it with my own Vue project, I still don't fully understand the authorization part. The issue has been stuck at "message":"Unauthorized: Error: Not Found".

@build With Hussain provided the integration process for frappe-ui.
https://github.com/frappe/frappe-ui/blob/main/src/utils/socketio.js

However, it seems that this only supports authorization using username and password, and it cannot be used with tokens.

Therefore,@nikkothari22 it is suggested to open up the idea so that everyone can share and improve the integration of socketio in frappe-js-sdk.

image

@nikkothari22
Copy link
Member Author

@guinanlin

Frappe only supports cookie based authentication for socket connections as far as I know. So adding support for API key based authentication for socket needs to be done in the Frappe framework (backend). We already have socket connections on frappe-react-SDK and they only work for cookie based auth as well.

@saivineeth100
Copy link

saivineeth100 commented Jul 28, 2024

@guinanlin

Frappe only supports cookie based authentication for socket connections as far as I know. So adding support for API key based authentication for socket needs to be done in the Frappe framework (backend). We already have socket connections on frappe-react-SDK and they only work for cookie based auth as well.

As per docs it supports token based auth also

image

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

No branches or pull requests

5 participants