Interaction with Kompos Debugger¶
This section gives a brief overview of the interaction between SOMns and Kompos.
Communication with Kompos¶
Communication between Kompos and SOMns is implemented with WebSockets, the code can be found in tools.debugger.FrontendConnector and vm-connection.ts. Data is transferred on two separate sockets, one is for JSON and the other one is for binary data.
JSON is used for two-way communication in a message-oriented style. Message objects are serialized to JSON when sending, and received JSON data is used to create message objects. Kompos also (de)serializes communication data, messages.ts provides some interfaces that help accessing data of message objects.
On the SOMns side, message classes need to be "registered" in tools.debugger.WebDebugger.createJsonProcessor(), they extend either IncomingMessage or OutgoingMessage. When an IncomingMessage is received, its process method is called.
The binary socket is used for directly sending tracing data, which is pushed to Kompos whenever available. Kompos parses the tracing data according to the trace format and uses the data to generate the actor graph.
Trace Format¶
The trace data includes for instance the following events:
- Actor creation
- Promise creation
- Promise resolution: when a Promise is resolved with a value.
- Promise chained: when a Promise is resolved with another Promise.
- and various others
An academic write up of the tracing feature and its format is part of our paper titled A Concurrency-Agnostic Protocol for Multi-Paradigm Concurrent Debugging Tools.
Startup Protocol¶
The following diagram gives an overview of the startup protocol. For simplicity the binary WebSocket for trace data and the view object are not included.