mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-15 03:46:24 +00:00
Small fixes, increase WS reconnection delay
This commit is contained in:
parent
8434a256cf
commit
8ae18f8b2a
@ -105,7 +105,6 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
connection.send({
|
connection.send({
|
||||||
message: robot.pubKey,
|
message: robot.pubKey,
|
||||||
nick: userNick,
|
nick: userNick,
|
||||||
authorization: `Token ${robot.tokenSHA256}`,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
connection.onMessage((message) => setServerMessages((prev) => [...prev, message]));
|
connection.onMessage((message) => setServerMessages((prev) => [...prev, message]));
|
||||||
@ -142,7 +141,6 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
connection.send({
|
connection.send({
|
||||||
message: `-----SERVE HISTORY-----`,
|
message: `-----SERVE HISTORY-----`,
|
||||||
nick: userNick,
|
nick: userNick,
|
||||||
authorization: `Token ${robot.tokenSHA256}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// If we receive an encrypted message
|
// If we receive an encrypted message
|
||||||
@ -214,7 +212,6 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
connection.send({
|
connection.send({
|
||||||
message: value,
|
message: value,
|
||||||
nick: userNick,
|
nick: userNick,
|
||||||
authorization: `Token ${robot.tokenSHA256}`,
|
|
||||||
});
|
});
|
||||||
setValue('');
|
setValue('');
|
||||||
}
|
}
|
||||||
@ -230,7 +227,6 @@ const EncryptedSocketChat: React.FC<Props> = ({
|
|||||||
connection.send({
|
connection.send({
|
||||||
message: encryptedMessage.toString().split('\n').join('\\'),
|
message: encryptedMessage.toString().split('\n').join('\\'),
|
||||||
nick: userNick,
|
nick: userNick,
|
||||||
authorization: `Token ${robot.tokenSHA256}`,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -276,7 +276,7 @@ export const useAppStore = () => {
|
|||||||
}, [delay, currentOrder, page, badOrder]);
|
}, [delay, currentOrder, page, badOrder]);
|
||||||
|
|
||||||
const orderReceived = function (data: any) {
|
const orderReceived = function (data: any) {
|
||||||
if (data.bad_request != undefined) {
|
if (data.bad_request) {
|
||||||
setBadOrder(data.bad_request);
|
setBadOrder(data.bad_request);
|
||||||
setDelay(99999999);
|
setDelay(99999999);
|
||||||
setOrder(undefined);
|
setOrder(undefined);
|
||||||
|
@ -3,7 +3,12 @@ import { WebsocketConnection } from '..';
|
|||||||
|
|
||||||
class WebsocketConnectionWeb implements WebsocketConnection {
|
class WebsocketConnectionWeb implements WebsocketConnection {
|
||||||
constructor(path: string) {
|
constructor(path: string) {
|
||||||
this.rws = new ReconnectingWebSocket(path, [], { connectionTimeout: 15000 });
|
this.rws = new ReconnectingWebSocket(path, [], {
|
||||||
|
connectionTimeout: 15000,
|
||||||
|
reconnectionDelayGrowFactor: 1.5,
|
||||||
|
maxRetries: 15,
|
||||||
|
maxReconnectionDelay: 1000000,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public rws: ReconnectingWebSocket;
|
public rws: ReconnectingWebSocket;
|
||||||
|
@ -160,7 +160,6 @@ class TokenAuthMiddleware(BaseMiddleware):
|
|||||||
dict((x.split("=") for x in scope["query_string"].decode().split("&")))
|
dict((x.split("=") for x in scope["query_string"].decode().split("&")))
|
||||||
).get("token_sha256_hex", None)
|
).get("token_sha256_hex", None)
|
||||||
token_key = hex_to_base91(token_key)
|
token_key = hex_to_base91(token_key)
|
||||||
print(token_key)
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
token_key = None
|
token_key = None
|
||||||
scope["user"] = (
|
scope["user"] = (
|
||||||
|
Loading…
Reference in New Issue
Block a user