Socket.IO-Client-Swift icon indicating copy to clipboard operation
Socket.IO-Client-Swift copied to clipboard

How to add array in connectparams using swift....

Open nirma358 opened this issue 10 years ago • 4 comments

let params:Dictionary = ["authtoken":auth!,"namespace":"[email protected]","owner_id":ownerId,"status":"online","addas":["1","2"]]

    socket = SocketIOClient(socketURL: "192.168.1.80:3310",options:[.ConnectParams(params),.Log(true),.ForceWebsockets(true)])
    socket.connect();

I am using above code ......app is crashing...when connecting.. if i remove addas parameter = ["1","2"].....it runs fine.....i guess its not encoding array in Dictionary

nirma358 avatar Oct 30 '15 09:10 nirma358

let params:Dictionary = ["authtoken":auth!,"namespace":"[email protected]","owner_id":ownerId,"status":"online","addas":["1","2"]]

        socket = SocketIOClient(socketURL: "192.168.1.80:3310",options:[.ConnectParams(params),.Log(true),.ForceWebsockets(true)])
        socket.connect();

I am using above code ......app is crashing...when connecting.. if i remove addas parameter = ["1","2"].....it runs fine.....i guess its not encoding array in Dictionary

nirma358 avatar Oct 30 '15 09:10 nirma358

What's it crashing with?

nuclearace avatar Oct 30 '15 13:10 nuclearace

in file SocketEngine.swift :-
for webSocket:- ws = WebSocket(url: NSURL(string: wsUrl)!)
for http:- let reqPolling = NSMutableURLRequest(URL: NSURL(string: urlPolling + "&b64=1")!)

NSUrl returning nil in both cases

nirma358 avatar Oct 31 '15 09:10 nirma358

Does this work in the JS client?

nuclearace avatar Oct 31 '15 14:10 nuclearace