Skip to content

Commit

Permalink
Fix documentation around pusher message decompression
Browse files Browse the repository at this point in the history
  • Loading branch information
such committed Mar 4, 2021
1 parent cf2187b commit 92900fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions guides/javascript_client/apollo_subscriptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ const pusherLink = new PusherLink({
pusher: pusherClient,
decompress: function(compressed) {
// Decode base64
const data = btoa(compressed)
const data = atob(compressed)
.split('')
.map(x => x.charCodeAt(0));
// Decompress
const payloadString = pako.inflate(data, { to: 'string' })
const payloadString = pako.inflate(new Uint8Array(data), { to: 'string' });
// Parse into an object
return JSON.parse(payloadString);
}
Expand Down

0 comments on commit 92900fe

Please sign in to comment.