Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.)
WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1709770] Wed, 30 September 2015 19:38 Go to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
Hi Im using mqttws31.js in an App created with NSBasic Appstudio. The app connects to a mosquito 1.4 broker using secure websockets on port 9002 just fine from Safari on OS X, and chrome, but when I connect from Safari or the web app on iOS9 mobile devices, I get the -9807 error code as in the subject line and mqtt doesn't connect. Any help in expanding logging on the server or client to help figure this out would be appreciated, thanks in advance.
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710187 is a reply to message #1709770] Mon, 05 October 2015 08:54 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Hi Jon, What does the javascript console show when you try to connect? It should contain some useful log output by default.
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710291 is a reply to message #1710187] Mon, 05 October 2015 17:35 Go to previous messageGo to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
All that shows in the javascript console is what I posted for the subject of this issue, the web socket network error OSStatus error -9807

Does anybody else have secure websockets running on iOS from javascript to mosquito 1.4.3?

I enabled detailed websocket logging on mosquito, this is the log of when the iPhone Safari tries and fails to connect

Oct 2 16:35:41 dev mosquitto[1247]: insert_wsi_socket_into_fds: wsi=0x1441130, sock=17, fds pos=2
Oct 2 16:35:41 dev mosquitto[1247]: inserted SSL accept into fds, trying SSL_accept
Oct 2 16:35:41 dev mosquitto[1247]: SSL_accept failed 2 / error:00000002:lib(0):func(0):system lib
Oct 2 16:35:41 dev mosquitto[1247]: SSL_ERROR_WANT_READ
Oct 2 16:35:41 dev mosquitto[1247]: SSL_accept failed 5 / error:00000005:lib(0):func(0):DH lib
Oct 2 16:35:41 dev mosquitto[1247]: SSL_accept failed skt 17: error:00000005:lib(0):func(0):DH lib
Oct 2 16:35:41 dev mosquitto[1247]: close: just_kill_connection
Oct 2 16:35:41 dev mosquitto[1247]: remove_wsi_socket_from_fds: wsi=0x1441130, sock=17, fds pos=2
Oct 2 16:35:41 dev mosquitto[1247]: not calling back closed
Oct 2 16:35:42 dev mosquitto[1247]: insert_wsi_socket_into_fds: wsi=0x1441130, sock=17, fds pos=2
Oct 2 16:35:42 dev mosquitto[1247]: inserted SSL accept into fds, trying SSL_accept
Oct 2 16:35:42 dev mosquitto[1247]: SSL_accept failed 2 / error:00000002:lib(0):func(0):system lib
Oct 2 16:35:42 dev mosquitto[1247]: SSL_ERROR_WANT_READ
Oct 2 16:35:42 dev mosquitto[1247]: SSL_accept failed 2 / error:00000002:lib(0):func(0):system lib
Oct 2 16:35:42 dev mosquitto[1247]: SSL_ERROR_WANT_READ
Oct 2 16:35:42 dev mosquitto[1247]: SSL_accept failed 5 / error:00000005:lib(0):func(0):DH lib
Oct 2 16:35:42 dev mosquitto[1247]: SSL_accept failed skt 17: error:00000005:lib(0):func(0):DH lib
Oct 2 16:35:42 dev mosquitto[1247]: close: just_kill_connection
Oct 2 16:35:42 dev mosquitto[1247]: remove_wsi_socket_from_fds: wsi=0x1441130, sock=17, fds pos=2
Oct 2 16:35:42 dev mosquitto[1247]: not calling back closed

comparing this with a successful connection from Chrome on OS X

Oct 2 16:33:30 dev mosquitto[1247]: insert_wsi_socket_into_fds: wsi=0x1430190, sock=16, fds pos=1
Oct 2 16:33:30 dev mosquitto[1247]: inserted SSL accept into fds, trying SSL_accept
Oct 2 16:33:30 dev mosquitto[1247]: SSL_accept failed 2 / error:00000002:lib(0):func(0):system lib
Oct 2 16:33:30 dev mosquitto[1247]: SSL_ERROR_WANT_READ
Oct 2 16:33:30 dev mosquitto[1247]: accepted new SSL conn
Oct 2 16:33:30 dev mosquitto[1247]: issuing 547 bytes to parser
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOKEN_NAME_PART 'G'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOKEN_NAME_PART 'E'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOKEN_NAME_PART 'T'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOKEN_NAME_PART ' '
Oct 2 16:33:30 dev mosquitto[1247]: known hdr 'GET '
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOK_(0) '/'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOK_(0) 'm'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOK_(0) 'q'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOK_(0) 't'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOK_(0) 't'
Oct 2 16:33:30 dev mosquitto[1247]: WSI_TOK_(0) â '
etc etc

i see its failing in DH lib. How do we dig deeper into whats causing it to fail please?

Jon
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710554 is a reply to message #1710291] Wed, 07 October 2015 13:40 Go to previous messageGo to next message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
Looks like the error is iOS / Safari specific, invalid certificate chain: http://www.osstatus.com/search/results?platform=all&framework=all&search=9807

Could be that the safari handles it differently from chrome?
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710583 is a reply to message #1710554] Wed, 07 October 2015 17:28 Go to previous messageGo to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
Interesting, thanks for the pointer to the error code. However, it works fine on desktop Safari and Chrome, just not on Mobile Safari, plus I have checked and rechecked the certificate chain and it scores a perfect A at several SSL test sites. I was able to test it under iOS8 and it also fails there, so its not just a iOS9 thing. Any further insights appreciated. Im not doing anything fancy here, is anyone else running secure web sockets from a JS app to Mosquitto 1.4.3?
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710585 is a reply to message #1710583] Wed, 07 October 2015 17:34 Go to previous messageGo to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
I checked with a successful connection from desktop Safari OS X and its pretty much the same as the Chrome connection, so I don't see difference there thats affecting this issue from mobile safari.

Oct 7 17:31:10 dev mosquitto[24554]: insert_wsi_socket_into_fds: wsi=0x1db4e80, sock=18, fds pos=3
Oct 7 17:31:10 dev mosquitto[24554]: inserted SSL accept into fds, trying SSL_accept
Oct 7 17:31:10 dev mosquitto[24554]: SSL_accept failed 2 / error:00000002:lib(0):func(0):system lib
Oct 7 17:31:10 dev mosquitto[24554]: SSL_ERROR_WANT_READ
Oct 7 17:31:11 dev mosquitto[24554]: accepted new SSL conn
Oct 7 17:31:11 dev mosquitto[24554]: issuing 598 bytes to parser
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOKEN_NAME_PART 'G'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOKEN_NAME_PART 'E'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOKEN_NAME_PART 'T'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOKEN_NAME_PART ' '
Oct 7 17:31:11 dev mosquitto[24554]: known hdr 'GET '
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOK_(0) '/'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOK_(0) 'm'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOK_(0) 'q'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOK_(0) 't'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOK_(0) 't'
Oct 7 17:31:11 dev mosquitto[24554]: WSI_TOK_(0) ' '
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710625 is a reply to message #1710585] Thu, 08 October 2015 03:30 Go to previous messageGo to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
So I used a free iOS App called SSL Detective to check my certificates. If I check port 443, I get a Green banner with a proper chain and it reports Certificate Chain Trusted. When I try it against the mosquitto ports 8883 or 9002, it shows no chain and in red message Chain not trusted. It points to some requirement of iOS that just isn't being met where other platforms and browsers don't seem to have an issue. I get an A+ when I check my cert on ssl checking sites. Its as if mosquitto isn't providing the chain correctly even though I have cafile correctly pointing to the valid CA cert chained with the intermediate cert bundle.

Does _anyone_ have secure websockets working from iOS? Could someone from the Paho group test it perhaps?

Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710626 is a reply to message #1710625] Thu, 08 October 2015 03:36 Go to previous messageGo to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
Heres a stackoverflow post about the error 5 in the DH lib, can we expand the logging to be more descriptive about the nature of the error as they suggest?

http://stackoverflow.com/questions/23479376/openssl-ssl-accept-error-5

"The TLS/SSL handshake was not successful but was shut down controlled and by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the return value ret to find out the reason."
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710630 is a reply to message #1710626] Thu, 08 October 2015 03:42 Go to previous messageGo to next message
Jon Mansey is currently offline Jon ManseyFriend
Messages: 7
Registered: September 2015
Junior Member
my research of this issue led me to this page from IBM indicating the state of clients and OSs. might only be relevant to their platform.

http://www-01.ibm.com/support/knowledgecenter/#!/SS9D84_1.0.0/com.ibm.mm.tc.doc/tc80002_.htm

I'm having trouble deciphering what it means exactly. Are they suggesting that in order for safari on iOS to work, it needs a CA or client cert installed?
Re: WebSocket network error: The operation couldn't be completed. (OSStatus error -9807.) [message #1710655 is a reply to message #1710630] Thu, 08 October 2015 08:51 Go to previous message
James Sutton is currently offline James SuttonFriend
Messages: 71
Registered: July 2015
Member
It looks that way, have you tried installing it and testing it that way?
Previous Topic:How to check if a client has a continued persistent session with the broker?
Next Topic:Is MqttClient thread safe?
Goto Forum:
  


Current Time: Thu Mar 28 22:47:36 GMT 2024

Powered by FUDForum. Page generated in 0.02789 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top