So, I am building an API with Django REST Framework for my React Native App. Now I want to implement a chat feature and I wanted to take Django Channels to build a realtime chat feature over a TCP Connection. Now I read I couldn't build a Realtime API with Django Channels. Does it mean, I can't use Django Channels on my Server and this in my React Native APP?:
var ws = new WebSocket('ws://host.com/path');
ws.onopen = () => {
// connection opened
ws.send('something'); // send a message
};
ws.onmessage = (e) => {
// a message was received
console.log(e.data);
};
ws.onerror = (e) => {
// an error occurred
console.log(e.message);
};
ws.onclose = (e) => {
// connection closed
console.log(e.code, e.reason);
};
I did unterstand it, like another version off a HTTP(S) connection or a kind of :)