FlexSim's native modeling language, FlexScript, does not natively support websockets. Without that support, anything you try will be a bit complicated.
Here are some alternative communication modes that may or may not work with your system:
========== SOCKETS ==========
FlexScript includes out-of-the-box support of Windows sockets. See the Command Reference > Communication commands section and search for the "client", "server" and "socket" commands. There are also related questions on this community that can help you with implementation.
========== WEBSOCKETS (using Chromium) ==========
FlexSim's integrated Chromium browser supports websockets.
You can use the commands callwebscriptmethod() and the JavaScript fireFlexsimEvent() function (on the Chromium side) to interact between your model logic and Chromium. See the version 21.0.0 Release Notes and History (flexsim.com) for information regarding fireFlexSimEvent's asynchronous nature.
This comment has an example model and some further explanation of callwebscriptmethod() and fireFlexsimEvent(), though it was created with an older version of FlexSim before fireFlexSimEvent() was asynchronous, so some updates may be required for this example to work in a modern version of FlexSim.
========== OPC UA ==========
FlexSim's OPC UA integration could communicate with a node-RED server you would set up. node-RED could then communicate with other services via websockets.
========== HTTP ==========
You could explore the HTTP api and whether your system can respond to HTTP requests. In addition to sending requests and receiving responses, if your simulation model needs to receive HTTP requests and send responses, you could learn about the FlexSim Webserver.