mirror of
https://github.com/joinmarket-webui/jam.git
synced 2026-08-20 13:28:21 +02:00
* feat: readd websocket connection * add WebsocketProvider * feat: update taker/maker state based on websocket data * update connection indicator based on websocket state * reconnect with linear backoff on websocket errors the backend is not happy with a second instance in another browser tab that send invalid tokens (e.g. because the previously used wallet was locked in another tab). This introduces a linear increase to a max of 10 seconds. Seems to ease the problem in the active tab. * send keepalive message periodically some webservers will close connections on inactivity rather soon by default (e.g. nginx is 60s). this commit contains sending a keepalive message periodically every 30 seconds. Co-authored-by: d11n <mail@dennisreimann.de>
28 lines
778 B
JavaScript
28 lines
778 B
JavaScript
const { createProxyMiddleware } = require('http-proxy-middleware')
|
|
|
|
module.exports = (app) => {
|
|
app.use(
|
|
createProxyMiddleware('/api/', {
|
|
target: 'https://localhost:28183',
|
|
changeOrigin: true,
|
|
secure: false,
|
|
ws: false,
|
|
onProxyReq: (proxyReq, req, res) => {
|
|
if (req.headers['x-jm-authorization']) {
|
|
proxyReq.setHeader('Authorization', req.headers['x-jm-authorization'])
|
|
}
|
|
},
|
|
})
|
|
)
|
|
|
|
// https://github.com/JoinMarket-Org/joinmarket-clientserver/blob/master/docs/JSON-RPC-API-using-jmwalletd.md#websocket
|
|
app.use(
|
|
createProxyMiddleware('/jmws', {
|
|
target: 'https://localhost:28283',
|
|
pathRewrite: { '^/jmws': '' },
|
|
changeOrigin: true,
|
|
secure: false,
|
|
ws: true,
|
|
})
|
|
)
|
|
}
|