Skip to content

"binascii.Error: Incorrect padding" when receiving binary message from Swift SocketIO client #1354

Answered by miguelgrinberg
fhfuih asked this question in Q&A
Discussion options

You must be logged in to vote

It appears the Swift port of Socket.IO is encoding base64 binary data without standard padding. I've found a stack overflow answer that suggests that the base64 encoder in Swift does not generate padding, even though this is the standard. The base64 spec says this:

Implementations MUST include appropriate pad characters at the end of
encoded data unless the specification referring to this document
explicitly states otherwise.

The Socket.IO protocol does not explicitly indicate if padding must be used or not, but the example included in the specification does use padding.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@fhfuih
Comment options

@miguelgrinberg
Comment options

@fhfuih
Comment options

Answer selected by fhfuih
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants