davidstump / SwiftPhoenixClient

Connect your Phoenix and iOS applications through WebSockets!
MIT License
506 stars 146 forks source link

Expose list of channels for each socket #240

Closed msandel6 closed 1 year ago

msandel6 commented 1 year ago

Context:

There are use cases where it's important to access existing channel instances. While it's possible to keep a local reference of joined channels, it would be safer and less error-prone for apps to be able to access a Socket's channels array directly.

Specific issue:

Note: this PR only allows clients using SwiftPhoenixClient to put in place a workaround, it doesn't actually fix what I believe is a bug.

This week I encountered a scenario in which a locally kept list of channels would get out of sync with the one kept by the Socket even without an obvious user error: