trick/trick_source/web/CivetServer/include/VariableServerSession.hh
Mrockwell2 7bc531273c
1720 websocket freeze issue (#1724)
* fixed web server freeze issue

* Revert "fixed web server freeze issue"

This reverts commit 7883453f6a.

* Fixed Webserver freeze issue

---------

Co-authored-by: Marcus Rockwell <marcusrockwell@gmail.com>
2024-06-27 10:25:22 -05:00

55 lines
1.6 KiB
C++

/*************************************************************************
PURPOSE: (Represent the state of a variable server websocket connection.)
**************************************************************************/
#ifndef WSSESSION_HH
#define WSSESSION_HH
#include <vector>
#include <string>
#ifndef SWIG
#include "CivetServer.h"
#endif
#include "trick/WebSocketSession.hh"
#include "trick/Executive.hh"
#include "VariableServerVariable.hh"
class VariableServerSession : public WebSocketSession {
public:
VariableServerSession(struct mg_connection *nc);
~VariableServerSession();
void marshallData(); /* -- base */
void sendMessage(); /* -- base */
int handleMessage(const std::string&); /* -- base */
void setTimeInterval(unsigned int milliseconds);
void addVariable(char* vname);
void stageValues();
void pause();
void unpause();
void clear();
void exit();
static int bad_ref_int ;
private:
int sendErrorMessage(const char* fmt, ... );
int sendSieMessage(void);
int sendUnitsMessage(const char* vname);
REF2* make_error_ref(const char* in_name);
void updateNextTime(long long simTimeTics);
double stageTime;
bool dataStaged;
std::vector<VariableServerVariable*> sessionVariables;
bool cyclicSendEnabled;
long long nextTime;
long long intervalTimeTics;
SIM_MODE mode;
};
WebSocketSession* makeVariableServerSession( struct mg_connection *nc );
#endif