I'm trying to create service which will interact between main service and remote api using http and websockets. I need to send data from main platform to API and than react to API incoming events imediantly.
Remote API has two parts: Http and WS. I understand how to interact with http part but don't clearly understand about ws. My main platform, service and sdk wrote by PHP. Also for service I use Redis as DB for save data of incoming events and their statuses. I think I can setup WS server to send data through it to remote API. But I don't see all picture.
How I imagine a hypothetical scenario:
- Core platform - create event
- My service handle this event, save data to Redis to check and for example change status, format data and send it through my SDK to WS server
- WS server has WebSocket connection with remote API. It publish my data to this stream
- Remote API get this data and return response
- Than, WS server is waiting incoming events from remote API
- If server receive incoming data, it send it to my service (or create event which my service will catch?)
- When service got incoming data it handle it and create event which main platform can handle
Am I right or it's wrong approach? Welcome to any help and tools titles :)