Giter Site home page Giter Site logo

eamigo86 / graphene-django-subscriptions Goto Github PK

View Code? Open in Web Editor NEW
183.0 12.0 21.0 1.31 MB

This package adds support to Subscription's requests and its integration with websockets using Channels package.

License: MIT License

Python 28.70% CSS 50.57% JavaScript 12.14% HTML 8.59%
api graphql graphene django subscription websocket channels

graphene-django-subscriptions's Issues

Not being maintain?

The last commit is last year and major GraphQL Django Libraries doesn't support this anymore.

Module import error

In your README file, you said to:
from graphene_django_subscriptions.subscription import Subscription
But:
ModuleNotFoundError: No module named 'graphene_django_extras.subscription'

AttributeError: 'NoneType' object has no attribute 'get'

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.

serializers

How you do the serializers of users and group ?

Channels 2

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.

Subscriptions are not allowed.

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?

What about v0.0.9?

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?

Django model serializer 'only_fields' not included in the payload

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!

'AnonymousObservable' object has no attribute 'errors'

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.