I am creating an application using hexagonal architecture. The application uses WebSocket connections to communicate with some outside clients. Communication works in both ways. the client can send a WebSocket message which the application needs to handle and the application can also send a WebSocket message to the client.
According to hexagonal architecture, an application service implements a port used by the driving adapter. Whereas, an application service uses the port implemented by a driven adapter. This will help me easily replace an old implementation with a new one by providing a new implementation for port (on the driving side) or adapter (on the driven side).
In my case of WebSocket communication, the WebSocket port acts both as the driving port (to handle messages coming from the actor) and the driven port (to send messages to the actor).
I am quite confused about how to solve this problem while sticking to the hexagonal architecture.