Search code examples
iosswiftsocketssocket.iowatchos-3

How to implement Socket connection in Watch OS 3.0


In one of my application we are implementing live stock market update using socket connection and we have implemented it using in iOS app using Socket.io. But we also developing same app in Watch OS 3.0. But compiler not able to deal with classes of Core Network prefixed with CFas like (CFHTTPMessage) with error of type CFHTTPMessage undeclared type.

So can any one implemented socket connection on Watch OS 3.0 ?

Is there any other way to accomplish same functionality on Watch OS ?

Is it fine to implement socket connection on Watch independently or we are going wrong way?

I have came across one watch app(Stock Tracker : Real Time Stock) with stock update which working independently without iOS App in background.

Thanks


Solution

  • Apple watch cannot do any network requests itself, everything is done via IPhone using Watch Connectivity framework to send and receive data: https://developer.apple.com/reference/watchconnectivity

    Apple watch is quite limited for now, as far as I know even though it was a wifi capabilities, they are not for developers. Those things are battery draining and as it's the major problem for Watch persistent connections (like sockets) are restricted.