Skip to content

Commit

Permalink
Add refresh support for websockets
Browse files Browse the repository at this point in the history
  • Loading branch information
madeline-pratt committed Nov 28, 2023
1 parent dc60bc9 commit 205e04b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cpp/handler/handlerengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1733,7 +1733,7 @@ class HandlerEngine::Private : public QObject
return;

// TODO: hint support for websockets?
if(f.action != PublishFormat::Send && f.action != PublishFormat::Close)
if(f.action != PublishFormat::Send && f.action != PublishFormat::Close && f.action != PublishFormat::Refresh)
return;

WsControlPacket::Item i;
Expand Down Expand Up @@ -1767,6 +1767,13 @@ class HandlerEngine::Private : public QObject
i.code = f.code;
i.reason = f.reason;
}
else if(f.action == PublishFormat::Refresh)
{
Deferred *d = ControlRequest::refresh(proxyControlClient, i.cid, this);
connect(d, &Deferred::finished, this, &Private::deferred_finished);
deferreds += d;
return;
}

writeWsControlItems(QList<WsControlPacket::Item>() << i);
}
Expand Down Expand Up @@ -3061,6 +3068,7 @@ private slots:
}

void stats_connectionsRefreshed(const QList<QByteArray> &ids)
g)
{
if(stateClient)
{
Expand Down
4 changes: 4 additions & 0 deletions src/cpp/handler/publishformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ PublishFormat PublishFormat::fromVariant(Type type, const QVariant &in, bool *ok
{
out.action = Close;
}
else if(action == "refresh")
{
out.action = Refresh;
}
else if(action.isNull() || action == "send") // default
{
out.action = Send;
Expand Down
1 change: 1 addition & 0 deletions src/cpp/handler/publishformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class PublishFormat
{
Send,
Hint,
Refresh,
Close
};

Expand Down

0 comments on commit 205e04b

Please sign in to comment.