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

Can't connect to dynamic channels #101

Open
owenljn opened this issue Oct 25, 2022 · 1 comment
Open

Can't connect to dynamic channels #101

owenljn opened this issue Oct 25, 2022 · 1 comment

Comments

@owenljn
Copy link

owenljn commented Oct 25, 2022

Hi,

I tried to specify a list of dynamic channels using formatting based on view keywords, the configuration looks like below:

application = ProtocolTypeRouter({
    'http': URLRouter([
        path('events/<obj_id>', AuthMiddlewareStack(URLRouter(
            django_eventstream.routing.urlpatterns
        )), { 'format-channels': [object-{obj_id}] }),
        re_path(r'', get_asgi_application()),
    ]),
})

in my views.py, I have this:

def home(request):
    context = {}
    context['url'] = '/events/{obj_id}'
    context['last_id'] = get_current_event_id(['time', 'time2'])
    return render(request, 'timeapp/home.html', context)

However, it's not able to connect to any channel, can you help take a look see what was wrong with my configuration? Thanks.

Edit:
If I want to specify a fixed list of channels, then I got this error:
stream error: bad-request: Invalid request: Channel limit exceeded.
it seems the maximum number of channels I can specify is 10, how do I specify more than 10 channels?

@jkarneges
Copy link
Member

The above code has some typos?

For the format-channels value, I think you meant:

['object-{obj_id}']

And I'm not sure {obj_id} gets substituted for anything here:

context['url'] = '/events/{obj_id}'

Regarding the channel limit, indeed it is limited to 10 per connection. It would probably not be hard to make this configurable, but a large number could impact scalability. How many channels are you needing?

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

No branches or pull requests

2 participants