Skip to content

Commit a999e38

Browse files
committed
backend: update JsonParam sends Ok to websocket on setting value successful, uWebsocketserver outputs error on create socket fail
1 parent 533bf45 commit a999e38

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

catflow/cpp/include/server/ApiuWebsocketsServer.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class ApiuWebsocketsServer: public ApiServer
8888
}
8989
});
9090

91+
hub.onError([this](int type){
92+
err("err on port " + to_string(type));
93+
});
9194
}
9295

9396
void start() override
@@ -96,7 +99,7 @@ class ApiuWebsocketsServer: public ApiServer
9699
serverThread = new thread([this](){
97100
if (hub.listen(Catflow::port)) {
98101
// run is blocking
99-
ok("listen for webSocket connection on port " + to_string(Catflow::port));
102+
ok("listen for webSocket/http connection on port " + to_string(Catflow::port));
100103

101104
// cache web files
102105
if (Catflow::httpServerPath.size() > 0) {
@@ -127,6 +130,7 @@ class ApiuWebsocketsServer: public ApiServer
127130

128131
hub.run();
129132
} else {
133+
fatal("listen for webSocket/http connection on port " + to_string(Catflow::port));
130134
}
131135
});
132136
ok("created serverWebsocket thread");

catflow/cpp/source/ApiJsonObject.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ ApiRespond *ApiJsonObject::processApi(ApiRequest request)
118118
try {
119119
// update own params by json, fromJson() will send update to subscribers but will skip sender
120120
this->fromJson(request.data, *request.client);
121+
return new ApiRespondOk(request);
121122
} catch (JsonObjectException &e) {
122123
return new ApiRespondError(e.what(), request, routeString);
123124
}

trainServer/source/source/NeuralNetwork.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,20 +171,6 @@ NeuralNetwork::NeuralNetwork(DataStructure *structure)
171171
graphBindIo();
172172
}
173173

174-
struct OpOrSymbol {
175-
Symbol symbol;
176-
Operator op;
177-
bool isSymbol = false;
178-
179-
OpOrSymbol(Symbol sym): op(""){
180-
isSymbol = true;
181-
symbol = sym;
182-
}
183-
184-
OpOrSymbol(Operator o): op(o){
185-
isSymbol = false;
186-
}
187-
};
188174

189175
void NeuralNetwork::setModelDefinition(vector<OperationNode> model)
190176
{

trainServer/source/source/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
4949
return 0;
5050
}
5151

52-
string hmtlFilesPath = cliArgs["html-files-path"].as<string>();
52+
string htmlFilesPath = cliArgs["html-files-path"].as<string>();
5353
string configStorePath = cliArgs["store-path"].as<string>();
5454
int port = cliArgs["port"].as<int>();
5555

@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
7676
Catflow::setApiRootRoute(apiRoot);
7777
Catflow::start<ApiuWebsocketsServer>(
7878
port,
79-
hmtlFilesPath // webserver root
79+
htmlFilesPath // webserver root
8080
);
8181

8282
// start blocking taskManager

0 commit comments

Comments
 (0)