Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { createContextToken } from '@marblejs/core';
import { Subject } from 'rxjs';
import { TransportLayer } from '../transport/transport.interface';
import { AllServerEvents } from './messaging.server.events';
import { Logger } from './messaging.server.logger';
export const TransportLayerToken = createContextToken();
export const ServerEventsToken = createContextToken>();
export const LoggerToken = createContextToken();
bindEagerlyTo,
createContextToken,
createServer,
matchEvent,
ServerEvent,
httpListener,
HttpServerEffect,
useContext,
} from '@marblejs/core';
import { mapToServer, MarbleWebSocketServer } from '@marblejs/websockets';
import { logger$ } from '@marblejs/middleware-logger';
import { merge } from 'rxjs';
import { tap, map } from 'rxjs/operators';
import { websocketsServer } from './websockets.server';
export const WsServerToken = createContextToken('MarbleWebSocketServer');
const root$ = r.pipe(
r.matchPath('/'),
r.matchType('GET'),
r.useEffect((req$, { ask }) => {
const wsServer = useContext(WsServerToken)(ask);
return req$.pipe(
tap(() => wsServer.sendBroadcastResponse({ type: 'ROOT', payload: 'Hello' })),
map(body => ({ body })),
);
}));
const upgrade$: HttpServerEffect = (event$, { ask }) =>
event$.pipe(
matchEvent(ServerEvent.upgrade),
import { createContextToken } from '@marblejs/core';
import { Subject } from 'rxjs';
import { TransportLayer } from '../transport/transport.interface';
import { AllServerEvents } from './messaging.server.events';
import { Logger } from './messaging.server.logger';
export const TransportLayerToken = createContextToken();
export const ServerEventsToken = createContextToken>();
export const LoggerToken = createContextToken();
matchEvent,
ServerEvent,
httpListener,
HttpServerEffect,
use,
useContext,
} from '@marblejs/core';
import { merge, forkJoin } from 'rxjs';
import { tap, map, mergeMap, mapTo } from 'rxjs/operators';
import { requestValidator$, t } from '@marblejs/middleware-io';
const port = process.env.PORT
? Number(process.env.PORT)
: undefined;
const ClientToken = createContextToken('MessagingClient');
const client = messagingClient({
transport: Transport.AMQP,
options: {
host: 'amqp://localhost:5672',
queue: 'test_queue',
queueOptions: { durable: false },
},
});
const rootValiadtor$ = requestValidator$({
params: t.type({
number: t.string,
}),
});
import { createContextToken } from '@marblejs/core';
import { Subject } from 'rxjs';
import { TransportLayer } from '../transport/transport.interface';
import { AllServerEvents } from './messaging.server.events';
import { Logger } from './messaging.server.logger';
export const TransportLayerToken = createContextToken();
export const ServerEventsToken = createContextToken>();
export const LoggerToken = createContextToken();
import { createContextToken } from '@marblejs/core';
import { MarbleWebSocketServer } from '@marblejs/websockets';
export const WsServerToken = createContextToken();