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

Why there is a hardcoded channel name prefix events- in case of pushpin proxy #122

Open
montaro opened this issue Jul 3, 2023 · 3 comments

Comments

@montaro
Copy link

montaro commented Jul 3, 2023

I was trying to send an event to a named channel test as in the docs, and this worked fine with the Channels setup. However, After configuration against fanout/pushpin proxy, messages are not delivered. After debugging, I found out that here the channel name is published to a different channel name with a hardcoded prefix events-!
What is the rationale behind this, please?

publish(
'events-%s' % quote(channel),

@jkarneges
Copy link
Member

Django-eventstream uses prefixes to differentiate between different types of channels. The events- channels are for regular events (i.e. for events sent with send_event), but there are also user- channels for targeting specific users (see the code for publish_kick).

This prefixing is handled internally, so you shouldn't need to worry about it in your app. When a client is subscribed to a channel, the prefix will automatically be added.

@montaro
Copy link
Author

montaro commented Jul 10, 2023

@jkarneges I'm using the django-eventstream with fastly/fanout/Pushpin proxy without Django Channels and I have to handle this manually, i.e. I need to handle the hardcoded events- in the fastly Compute@Edge code because the whatever the channel name I use in the send_event() will get a prefix events-.
Is it really a desired behaviour in the setup without Django Channels?

@jkarneges
Copy link
Member

jkarneges commented Jul 11, 2023

It sounds like you might be writing your own handler code for Compute@Edge rather than deferring to the handler code from django-eventstream. Is that on purpose? The proper way to use django-eventstream with Fastly would be to have requests forwarded to your backend django app so they can be handled the usual way. You can use Compute@Edge code like this: https://github.com/fastly/compute-starter-kit-rust-fanout-forward

If you do mean to write code on Compute@Edge to substitute the handler code in django-eventstream, then yes you'll need to format channel names in the way django-eventstream expects, which should not be surprising.

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