How to use the node-opcua-service-endpoints.GetEndpointsResponse function in node-opcua-service-endpoints

To help you get started, we’ve selected a few node-opcua-service-endpoints examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-secure-channel / test_helpers / mock / mock_transport.ts View on Github external
export const fakeCloseSecureChannelResponse = new CloseSecureChannelResponse({});

export const fakeOpenSecureChannelResponse = new OpenSecureChannelResponse({
    serverProtocolVersion: 0,

    securityToken: {
        channelId: 23,
        createdAt: new Date(), // now
        revisedLifetime: 30000,
        tokenId: 1,
    },
    serverNonce: Buffer.from("qwerty")
});

export const fakeGetEndpointsResponse = new GetEndpointsResponse({
    endpoints: [
        {
            endpointUrl: "fake://localhost:2033/SomeAddress"
        }
    ]
});

export const fakeCreateSessionResponse = new CreateSessionResponse({});
export const fakeActivateSessionResponse = new ActivateSessionResponse({});

export class MockServerTransport extends EventEmitter {

    private _replies: any;
    private _mockTransport: DirectTransport;
    private _counter: number;
github node-opcua / node-opcua / packages / node-opcua-server / source / base_server.ts View on Github external
protected _on_GetEndpointsRequest(message: Message, channel: ServerSecureChannelLayer) {

        const server = this;
        const request = message.request as GetEndpointsRequest;

        assert(request.schema.name === "GetEndpointsRequest");

        const response = new GetEndpointsResponse({});

        response.endpoints = server._get_endpoints();

        response.endpoints = response.endpoints.filter(
          (endpoint: EndpointDescription) => !(endpoint as any).restricted);

        // apply filters
        if (request.profileUris && request.profileUris.length > 0) {
            response.endpoints = response.endpoints.filter((endpoint: any) => {
                return request.profileUris!.indexOf(endpoint.transportProfileUri) >= 0;
            });
        }

        // adjust locale on ApplicationName to match requested local or provide
        // a string with neutral locale (locale === null)
        // TODO: find a better way to handle this