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

Could not custumize messages handlers #13

Closed
tboulogne opened this issue Jul 30, 2018 · 5 comments
Closed

Could not custumize messages handlers #13

tboulogne opened this issue Jul 30, 2018 · 5 comments

Comments

@tboulogne
Copy link
Contributor

Hello,

Could you explain how to customize this handlers please ? Look into documentation and try to apply but did not works.

Note : debug works fine.

Thanks for help.

Regards,

Thierry

synw added a commit that referenced this issue Jul 30, 2018
@synw
Copy link
Owner

synw commented Jul 30, 2018

Hi. I rewrote the docs to make it more clear. It was a bit messy yes, specially the client side handlers: this should be better now. Thanks for mentioning it.

Please check out the client side handlers part and let me know if anything is unclear or wrong anymore

@tboulogne
Copy link
Contributor Author

tboulogne commented Jul 30, 2018

hello,

My template directory is like this

templates
 I_ instant
    I_ handlers
       I- default.js

Into default.js i get :

if (channel === "public") {
    console.log(message)
 }

But nothing into console.log. I enable watch option on instant admin, i could see messages.

Any idea please ?

@synw
Copy link
Owner

synw commented Jul 30, 2018

The default public channel name is settings.SITE_SLUG_public, so if your SITE_SLUG value in settings is my_site, your channel will be named mysite_public.
You can check in the debug console for the connected channels. Note: it is better to use declarative channels: it is more explicit and you can even control where it should connect from. In settings, and the default public channel will be deprecated in the future

INSTANT_ENABLE_PUBLIC_CHANNEL = False  # do not use the default chan
# declare my chan
INSTANT_PUBLIC_CHANNELS = [
    ['public_chan'],
]

Then use a templates/instant/handlers/public_chan.js handler, or just stick with the default handler

I plan to work on better error messages btw,

{Edit]:

I enable watch option on instant admin, i could see messages.

Check the channel name in the json console message to make sure it is ok

{Edit 2]

nothing into console.log

Did you set the INSTANT_DEBUG setting to True? It should show you if you are connected on a channel or not. Did you include the client template?

@tboulogne
Copy link
Contributor Author

my bad again !
In my different tests to make it work i remove the client.

Thanks i'm on the way now ;).

@synw
Copy link
Owner

synw commented Jul 30, 2018

That's it! Enjoy

@synw synw closed this as completed Jul 30, 2018
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