Reputation: 187
I want to make a chat app using Django in iOS. The server-side socket communication method that I've chosen is django-socketio because it integrates well with django. So my problem is selecting a way to implement the client side on iOS. All the django-socketio client examples are in javascript e.g-
To subscribe to a channel client-side in JavaScript use the socket.subscribe method:
var socket = new io.Socket();
socket.connect();
socket.on('connect', function()
{
socket.subscribe('my channel');
});
I want to know how to implement such a code in my iOS client, as in how to implement the "subscribe()" channel function from it, and how to implement interactivity from iOS to the various other events defined by the django-socketio server like:
@on_connect
def my_message_handler(request, socket, context):
...
and @on_message
, @on_subscribe
, etc.
I'm currently trying to use NSStream and CFStream as shown here, but it's proving difficult for me to convert it in a way to make it talk with django-socketio server.
(Note: for all those who saw the last "here" link, yea I did go the way of using twisted first instead of django-socketio, but it doesn't have any well-defined concrete method of integration with django (Yes, I tried searching it everywhere). Maybe it will be my next question here.
Upvotes: 1
Views: 388
Reputation: 8937
https://github.com/pkyeck/socket.IO-objc
PS: Now it doesn't support socketio protocol 1.0, neither django-socketio.
Upvotes: 0