WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 199906
REGRESSION: WebSockets no longer work in Service Workers
https://bugs.webkit.org/show_bug.cgi?id=199906
Summary
REGRESSION: WebSockets no longer work in Service Workers
James Lees
Reported
2019-07-18 07:59:29 PDT
It seems Websocket connections no longer work in service workers. I created a small demo app to demonstrate the issue
https://service-worker-example-zzobdmsvlg.now.sh
(src:
https://github.com/leesio/service-worker-example
) Alternatively, a simple way recreate Open the safari developer tools in any service worker context on an iOS device running 12.3+ Try to create a websocket connection e.g. const wsUrl = 'wss://ws-test1.staging.pusher.com:443/app/9f35c4ed36479d45cbea?protocol=7&client=js&version=4.4.0&flash=false'; const handler = (event) => console.log('event', event.type, event.data) let socket = new WebSocket(wsUrl); socket.onerror = handler; socket.onopen = handler; socket.onmessage = handler; socket.onclose = handler; Observe the results macOS Safari - 10.14.5 (18F132) [Log] event – "open" – undefined [Log] event – "message" – "{\"event\":\"pusher:connection_established\",\"data\":\"{\\\"socket_id\\\":\\\"5234.586038\\\",\\\"activity_timeout\\\":120}\"}" Safari on iOS 12.3.1 on iPhone SE [Log] event – "error" – undefined [Log] event – "close" – undefined It's not clear to me whether this was a deliberate change, or a regression. The example app shows websockets work fine on my Xcode simulator running iOS 12.2, but not on any real devices running 12.3.1 (tried iphone 6s and iPhone SE)
Attachments
A screengrab of the test application working on macOS Safari
(114.94 KB, image/png)
2019-07-19 01:53 PDT
,
James Lees
no flags
Details
Patch
(3.62 KB, patch)
2019-07-29 13:56 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2019-07-18 16:46:26 PDT
Hi James, Thanks for the report. Can you confirm that WebSocket connections work for you on MacOSX but not on iOS? I tried your example and I got a 1006 error on both MacOS and iOS.
James Lees
Comment 2
2019-07-19 01:53:06 PDT
Created
attachment 374452
[details]
A screengrab of the test application working on macOS Safari Hi Youenn, Thanks for getting back to me so quickly. I can confirm that the demo app works fine for me in macOS Safari. I've attached a screengrab showing the results. Note that the close events are expected - service worker closes the connection 2s after opening it!) My macOS version is 10.14.5 (18F132). If there's anything else you need from me please don't hesitate to get in touch. James
Radar WebKit Bug Importer
Comment 3
2019-07-24 15:39:39 PDT
<
rdar://problem/53516732
>
youenn fablet
Comment 4
2019-07-29 09:54:11 PDT
I did some debugging and it seems that this may be a regression from
https://bugs.webkit.org/show_bug.cgi?id=193529
.
youenn fablet
Comment 5
2019-07-29 13:56:02 PDT
Created
attachment 375097
[details]
Patch
Geoffrey Garen
Comment 6
2019-07-29 14:18:37 PDT
Comment on
attachment 375097
[details]
Patch Can we regression test this? Seems like a pretty serious failure not to test.
youenn fablet
Comment 7
2019-07-29 14:30:25 PDT
(In reply to Geoffrey Garen from
comment #6
)
> Comment on
attachment 375097
[details]
> Patch > > Can we regression test this? Seems like a pretty serious failure not to test.
The current test was bogus as it was passing while it should not. The test is now covering this properly.
Geoffrey Garen
Comment 8
2019-07-29 14:32:57 PDT
Comment on
attachment 375097
[details]
Patch r=me
WebKit Commit Bot
Comment 9
2019-07-29 14:43:49 PDT
Comment on
attachment 375097
[details]
Patch Clearing flags on attachment: 375097 Committed
r247923
: <
https://trac.webkit.org/changeset/247923
>
WebKit Commit Bot
Comment 10
2019-07-29 14:43:51 PDT
All reviewed patches have been landed. Closing bug.
James Lees
Comment 11
2019-07-30 01:10:50 PDT
Great news. This is the first time I've reported a WebKit bug so I don't know much about the release cycles etc. When is this fix likely to make it into iOS Safari? Apologies if this isn't the right place for this question.
Alexey Proskuryakov
Comment 12
2019-07-30 09:01:13 PDT
Indeed, we do not comment on Apple's release schedules or plans. However, any information on customer impact would be used for prioritization. Are there any live websites, apps, or release plans that you are aware of that are impacted by this?
James Lees
Comment 13
2019-07-31 02:38:42 PDT
Alexey, Understood. It may be a little bit difficult for me to provide end-user impact. We're a bit of a middleperson in all of this - we provide a set of libraries/APIs that allow our customers to add realtime functionality to *their* websites/apps. As a result it's hard to know if other users have been affected and haven't raised a support issue. We first noticed this bug when a customer reported our pusher-js library no longer worked in service-workers on iOS. I've asked that customer for more information about how this issue is affecting them. I'll also add a note to our github issue asking for more input from users. Thanks for your help on this
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug