NFIBrokerage / slipstream

A slick WebSocket client for Phoenix Channels
https://hex.pm/packages/slipstream
Apache License 2.0
160 stars 18 forks source link

Possible incorrect documentation? #47

Closed cadebward closed 2 years ago

cadebward commented 2 years ago

Hey there!

First off, love the library. Huge thanks for building it 👏

Documentation in question: https://github.com/NFIBrokerage/slipstream/blob/main/lib/slipstream.ex#L537

As I'm using it, I noticed I was getting an error due to double wrapping the socket in :ok tuples. Is line meant to be

@impl Slipstream
def handle_disconnect(_reason, socket) do
  reconnect(socket)
end

instead of {:ok, reconnect(socket)?

the-mikedavis commented 2 years ago

Ah great catch! Looks like the spec on reconnect/1 returns {:ok, Socket.t()} in success so that doc line double wraps it. (Actually, it looks like reconnect/1 is mis-spec'd too.) I'll push a commit to fix both of those 👍