Cross origin websockets with Golang
This is not the case with the PhoneGapplication running on the iOS Simulator. In the Simulator, Safari can in fact reach my testing/diagnostic page. However, the PhoneGapplication times out.
I'm doing more investigations but my suspicion is that this is a simple server configuration issue and someone with more knowledge of Go and/or the blessed websockets package and I thought I'd ask here concurrent with my investigation.
CORS does not apply to WebSocket. With WebSocket, there is an "origin" header, which browser MUST fill with the origin of the HTML containing the JS that opens the WS connection. Non-browser clients may or may not fill that header (and can fill it with anything they like anyway). The WS server then is able to decide whether to accept the connection or not.
Further: I don't know if the WebView used by PhoneGap sets the origin header when the HTML comes from local filesystem. I would try wiretap the traffic and have a look.
There is no Cross Domain concern in PhoneGAP appliations (remember that this policy is enforced client side and that the server's header only give an indication).
The problem is probably in your handshake as PhoneGAP doesn't support natively the websocket handshake. There are open source projects introducing it in PhoneGAP/iOS as this one (not tested by me as I'm not an iOS developer).