Your statement "the http interface in FlexSim" is very vague.
If you are using applicationcommand("sendhttprequest"), then FlexSim is sending synchronous http requests directly with the WinHttp API.
The other internet technologies you have mentioned (server-sent events and long-polling) assume that the client machine is rendering an HTML page and executing Javascript.
You can do that in FlexSim, but you don't use applicationcommand("sendhttprequest").
Instead, you use an HTML widget in a Custom GUI. Within the HTML widget, you can write custom HTML and Javascript code that interacts with a server on the internet.
This is how the Start Page works.
You can use the fireFlexsimEvent() function in JavaScript to execute FlexScript that affects your model. You can use the callwebscriptmethod() command in FlexScript to execute a JavaScript function in your HTML page.
From an HTML widget, you can then both interact with a server on the internet and interact with your model using whatever web technologies are supported by the server you are interacting with and the Webkit library that FlexSim uses to render HTML pages and execute Javascript. (I don't know specifically what internet technologies, such as server-sent events, long polling, ajax, etc, work with Webkit. Your best best to find out whether a certain technology works is to imeplement it within a regular webpage using a web browser such as Chrome or Firefox, then port that HTML/Javascript code into an HTML Widget in FlexSim and see if it still works.)
Webkit probably supports server-sent events, so this is probably easily doable in FlexSim by using an HTML widget (although I haven't tested it to know for sure whether this works). Here is a link to a simple example of writing client-side JavaScript and server-side php code that interacts with server-sent events.
The FlexSim Webserver is an application that performs the work of a web server (hence its name). It is used server-side (as opposed to client-side) to facilitate receiving HTTP requests, passing them on to FlexSim, receiving an HTML response from FlexSim, and then sending that HTML response over the internet back to the client, such as a web browser on someone's computer or another application that communicates via HTTP.
You could use the FlexSim Webserver to spawn an instance of FlexSim, which uses applicationcommand("sendhttprequest") to communicate with an external server, and the external server sends http requests back to the FlexSim Webserver that passes them on to FlexSim. This creates 2 synchronous communication paths where both sides are servers communicating with each other. This is probably not a very good solution for what you are trying to do; polling would be a better solution than this.
The final option is to make a custom C++ DLL that uses whatever internet technology you want to communicate, such as WebSockets. I haven't personally used it, but apparently libwebsockets is a lightweight pure C library that implements WebSockets, which provides full-duplex communication channels over a single TCP connection.
Phil BoBo
Sr. Manager, Software Development