Closed aleprovencio closed 9 years ago
Hi! It seems that you create chat_params
in a correct way. Do you have exceptions? Why you decided that you have not succeeded?
Taking 'info' out of Centrifuge objection creation makes the chat work fine, otherwise it will not.
This is the javascript portion:
var centrifuge = new Centrifuge({
url: '{{ chat_params.sockjs_endpoint }}',
project: '{{ chat_params.project }}',
user: '{{ chat_params.user }}',
timestamp: '{{ chat_params.timestamp }}',
info: '{{ chat_params.info }}',
token: '{{ chat_params.token }}',
debug: true
});
And the rendered html source:
var centrifuge = new Centrifuge({
url: 'http://127.0.0.1:8000/connection',
project: 'development',
user: '5',
timestamp: '1443622504',
info: '{"nick": "test1"}',
token: 'f36efcd0dc5f8dac3b818d1a223ab1a072b24e44873804b7d5af7a3bc5805c62',
debug: true
});
Maybe it has something to do with the 'quot;' char?
Have you tried {{ chat_params.info|safe }}
?
Did the trick! Thank you for the help e sorry about such a dumb mistake :)
You are welcome, this is not so clear so I added information to README.md
Hello, I would like to use CENTRIFUGE_INFO so I can set nicknames for users. Using the context_processor may be the most convenient, but I can't find a way. I also tried without success using on the view this way below, what's wrong?