Bridge Messages to Native Handlers
Implement a bridge that receives messages from a WebView and routes them to native handlers. Messages arrive as JSON strings with type, id, and payload. If a handler for a message type is not yet registered, queue the message and deliver it later in FIFO order when that handler becomes available.
Constraints
- 1 <= len(messages) <= 10^4
- Each message contains valid JSON with keys
type,id, andpayload - Message
idvalues are unique - Handler registration may happen multiple times
- Preserve FIFO order for queued messages of the same type
You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.


