Skip to content

msight_core.nodes.source_server

msight_core.nodes.source_server

ServerSourceNode

Bases: SourceNode, ABC

Base class for server-style source nodes.

Subclass responsibilities: - Implement initialize() to set up the server and hook its message handler so that it calls self.handle_incoming(data). - Implement serve() to run the server loop. This is called by _spin() / spin().

You MAY override __init__, but you MUST: - call super().init(configs) - ensure that initialize() is called (either by relying on the base init calling it, or by calling self.initialize() yourself).

initialize() abstractmethod

Initialize the server source node.

This is where subclasses should: - create/configure the underlying server object - hook the server's message handling so that it calls self.handle_incoming(data) for each received message

If you override init, you are responsible for ensuring initialize() is called at least once.

serve() abstractmethod

Start serving incoming connections.

This method should block and run the main server loop, calling self.handle_incoming(data) whenever a new message arrives.

handle_incoming(raw_data)

Wrapper to be called by the server whenever a message is received.

Subclasses normally do NOT override this. They should: - convert raw input into a Data instance before calling this (e.g., ImageData(frame, timestamp, sensor_name)) - then call: self.handle_incoming(data_obj)

start()

User-friendly alias for spin().

on_message(data) abstractmethod

You have to override this method if you want to process the data before publishing.