Bourse.WS.AuthAck (bourse v0.7.0)

Copy Markdown View Source

Recognises which inbound frame is a venue's answer to an auth attempt.

The parallel of Bourse.WS.SubscribeAck, and it exists for the same reason: on the asynchronous venues the auth reply arrives in the caller's mailbox behind whatever else the socket is already delivering, so the waiter has to tell "this is the auth outcome" apart from "this is a data frame".

The pattern modules' own handle_auth_response/2 cannot answer that. Each ends in a catch-all that reads an unrecognised frame as {:error, {:auth_failed, frame}} — correct once you know the frame is the auth reply, and a false rejection for any heartbeat or tick that happens to land first. So recognition happens here and adjudication stays there: classify/2 only decides whether the frame belongs to the handshake.

Summary

Functions

Says whether frame is the venue's response to pattern's auth attempt.

Types

classification()

@type classification() :: :auth_response | :not_auth

Functions

classify(arg1, frames)

@spec classify(Bourse.WS.Auth.pattern(), map() | [map()]) :: classification()

Says whether frame is the venue's response to pattern's auth attempt.

Returns :auth_response for a frame the pattern's classifier should judge, and :not_auth for anything else — leave those in the mailbox.