Skip to content

Conversation

@maslowalex
Copy link

@maslowalex maslowalex commented Nov 25, 2025

This pull request is an attempt to fix currently unhandled scenario when we have incoming frames before the Websocket connection is being established.

The error stacktrace:

[error] 21:52:29.761  :gen_statem #PID<0.629.0> terminating
** (BadMapError) expected a map, got:

    nil

    (mint_web_socket 1.0.4) lib/mint/web_socket/frame.ex:103: Mint.WebSocket.Frame.encode/2
    (fresh 0.4.4) lib/fresh/connection.ex:221: Fresh.Connection.send_frame/2
    (elixir 1.19.2) lib/enum.ex:2520: Enum."-reduce/3-lists^foldl/2-0-"/3
    (fresh 0.4.4) lib/fresh/connection.ex:280: Fresh.Connection.handle_generic_callback/2
    (fresh 0.4.4) lib/fresh/connection.ex:139: Fresh.Connection.connected/3
    (stdlib 7.1) gen_statem.erl:3748: :gen_statem.loop_state_callback/11
    (stdlib 7.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3
Queue: [info: {:subscribe_candles, ["5m"]}]
Postponed: []

@maslowalex maslowalex changed the title fix: unhandled incomming frames before websocket connection is established fix: unhandled incoming frames before websocket connection is established Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant