hagsteel / swampdragon

swampdragon
Other
556 stars 73 forks source link

c[3001,"Connection aborted"] #173

Open cdvv7788 opened 9 years ago

cdvv7788 commented 9 years ago

I am trying to setup a simple flow for notifications. Something like:

class NotificationRouter(ModelPubRouter):
    route_name = 'notification-router'
    valid_verbs = ['subscribe']
    model = Notification
    serializer_class = NotificationSerializer

    def get_subscription_channels(self, **kwargs):
        return ['notification']

route_handler.register(NotificationRouter)

The serializer is just a ModelSerializer that should return the id:

class NotificationSerializer(ModelSerializer):
    class Meta:
        model = 'notifications.models.Notification'
        publish_fields = ('id', )

On javascript i am trying to subscribe, but all i am getting is c[3001,"Connection aborted"]. The subscribe() function is not even calling it's failure function. swampdragon.ready is being reached tho.

I can't find the cause of this error anywhere, and the dragon server is quite silent, which does not help either. What's your approach to debugging issues like these?

AlexejStukov commented 9 years ago

You are using ModelPubRouter and should therefore overwrite get_subscription_context and not get_subscription_channels (documentation).