eamigo86 / graphene-django-subscriptions Goto Github PK
View Code? Open in Web Editor NEWThis package adds support to Subscription's requests and its integration with websockets using Channels package.
License: MIT License
This package adds support to Subscription's requests and its integration with websockets using Channels package.
License: MIT License
ERROR: graphene-django-subscriptions 0.0.6 has requirement graphene-django==2.0.0, but you'll have graphene-django 2.5.0 which is incompatible.
The last commit is last year and major GraphQL Django Libraries doesn't support this anymore.
In your README file, you said to:
from graphene_django_subscriptions.subscription import Subscription
But:
ModuleNotFoundError: No module named 'graphene_django_extras.subscription'
Please help me figure this out. i have successfully configured this package to work with the graphiql query browser interface. however i cannot get any responses when i send a message over the websocket. am using subscriptions-transport-ws on the client side and graphene django on the backend.
here is my setUpSubscription from the client environment file
const setupSubscription = (config, variables, observer, operationName, context) => {
const query = config.text;
const subscriptionClient = new SubscriptionClient(websocketurl, {
reconnect: true,
timeout: 20000,
connectionCallback: (message) => {
variables.channelId = message.channel_id;
console.log(channelId);
}
});
variables.operationName = 'projectSubscription';
console.log(variables);
subscriptionClient.onConnected((message) => {
console.log(`connected...${message}`);
const client = subscriptionClient.request({ query, variables }).subscribe({
next: (result) => {
observer.onNext({ data: result });
},
complete: (result) => {
observer.onComplete(console.log(result));
},
error: (error) => {
observer.onError(error);
}
});
return {
dispose: client.unsubscribe
};
});
};
for example when i send the message {"id":"1","type":"start","payload":{"query":"subscription projectSubscription(\n $channelId: String!\n) {\n projectSubscription(operation: SUBSCRIBE, action: ALL_ACTIONS, channelId: $channelId, data: [ID, PROJECT_CODE, NAME, LOCATION_ID, ALLOCATED_AMOUNT, PROJECT_TYPE_ID, PROJECT_VALUE, PROJECT_STATUS_ID, PROJECT_MANAGER_ID, VENDOR_ID, EXPENDED_AMOUNT, DURATION_IN_DAYS, START_DATE, END_DATE, CREATED_AT, UPDATED_AT]) {\n ok\n error\n stream\n operation\n action\n }\n}\n","variables":{"channelId":"ugJtifiitN!INdeqQJmLW","operationName":"projectSubscription"}},"stream":"projects"}
i dont get any response from the server but i see the error AttributeError: 'NoneType' object has no attribute 'get'
from the deserialise method in the mixins module. how can i ensure i get a response just like when i execute the subscription from the graphql browser interface? Please help.
How you do the serializers of users and group ?
Hello,
Would it be possible to have an example of use with channels 2 ?
Also, I have seen that from graphene_django_subscriptions.consumers import GraphqlAPIDemultiplexer
is not accurate in the documentation as it uses subscriptions instead of consumers.
The documentation is unclear about how to use the new api.
Thanks in advance.
I've tried to install 0.0.9
into a python 3.8.1
venv runnning django 3.0.2
and graphene-django [required: >= 2.1.7,<3, installed: 2.1.8]
without success. Seems like it relates to install_requires=[..., 'graphene-django==2.0.0', ...]
. Could we relax this pinning to enable support for this current latest version setup? Relates to #11
I followed the example and I got
Subscriptions are not allowed. You will need to either use the subscribe function or pass allow_subscriptions=True
What am I missing?
On pypi.org there is a version 0.0.9 which does not correspond to anything in this repo. Where is the source code for that?
Hi!
Any plans on supporting Channels 2 out of the box?
Thanks
I was having issues trying to get the fields that it included in the the data attribute of the subscription to populate in the payload. Curiously, I was able to get the id to show up, but I couldn't get any of the other attributes of my model to populate in the payload. After inspecting the source code and removing the modifications to the field values (stripping '' and changing to uppercase) in line 78 of subscription.py I was able to fix the problem and get the fields that I wanted in the payload. I'm assuming that there was a reason for including the change to upper and removing the '', but I just wanted to inform you that it was causing a bug for me. I really appreciate the work you have done and hope you can create a fix for this issue in the future!
Hi. I need to add subscriptions to my graphene-django project. But I've landed with the following error: 'AnonymousObservable' object has no attribute 'errors'
raised in graphene_django/views.py", line 164, in get_response
. Have you met this error before? Or do you have any thoughts how can it be resolved?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.