13.1.1 • Published 2 years ago

@nguniversal/socket-engine v13.1.1

Weekly downloads
612
License
MIT
Repository
github
Last release
2 years ago

Angular Universal Socket Engine

Framework and Platform agnostic Angular Universal rendering.

Deprecated

This package has been deprecated. Please use @nguniversal/common instead.

Usage Server

npm install @nguniversal/socket-engine @nguniversal/common --save

const socketEngine = require('@nguniversal/socket-engine');

// * NOTE :: leave this as require() since this file is built Dynamically from webpack
const { AppServerModuleNgFactory, LAZY_MODULE_MAP } = require('./dist/server/main');

socketEngine.startSocketEngine(AppServerModuleNgFactory);

This will the socket engine which internally hosts a TCP Socket server.
The default port is 9090 and host of localhost You may want to leave this as a plain .js file since it is so simple and to make deploying it easier, but it can be easily transpiled from Typescript.

Usage Client

Your client can be whatever language, framework or platform you like.
As long as it can connect to a TCP Socket (which all frameworks can) then you're good to go.

This example will use JS for simplicity

import * as net from 'net';

const client = net.createConnection(9090, 'localhost', () => {
  console.log('connected to SSR server');
});

client.on('data', (data) => {
  const res = JSON.parse(data.toString()) as SocketEngineResponse;
  expect(res.id).toEqual(1);
  expect(res.html).toEqual(template);
  server.close();
  done();
});

const renderOptions = {
  id: 1,
  url: '/path',
  document: '<app-root></app-root>',
} as SocketEngineRenderOptions;
client.write(JSON.stringify(renderOptions));
13.1.1

2 years ago

13.1.0

2 years ago

13.0.2

2 years ago

13.1.0-next.1

2 years ago

13.0.1

2 years ago

13.0.0

3 years ago

13.0.0-rc.2

3 years ago

12.1.3

3 years ago

13.1.0-next.0

3 years ago

12.1.2

3 years ago

13.0.0-rc.1

3 years ago

13.0.0-rc.0

3 years ago

12.1.1

3 years ago

12.1.0

3 years ago

12.1.0-next.0

3 years ago

12.0.2

3 years ago

12.0.1

3 years ago

12.0.0

3 years ago

12.0.0-rc.1

3 years ago

12.0.0-rc.0

3 years ago

12.0.0-next.1

3 years ago

11.2.1

3 years ago

12.0.0-next.0

3 years ago

11.2.0

3 years ago

11.1.2

3 years ago

11.1.1

3 years ago

11.1.0

3 years ago

11.1.0-next.0

3 years ago

11.0.1

3 years ago

11.0.0

3 years ago

11.0.0-rc.0

4 years ago

11.0.0-next.2

4 years ago

11.0.0-next.1

4 years ago

11.0.0-next.0

4 years ago

10.1.0

4 years ago

10.1.0-rc.0

4 years ago

10.0.2

4 years ago

10.0.1

4 years ago

10.0.0

4 years ago

10.0.0-rc.1

4 years ago

10.0.0-rc.0

4 years ago

10.0.0-next.0

4 years ago

9.1.1

4 years ago

9.1.0

4 years ago

9.0.2

4 years ago

9.0.1

4 years ago

9.0.0

4 years ago

9.0.0-rc.2

4 years ago

9.0.0-rc.1

4 years ago

9.0.0-rc.0

4 years ago

9.0.0-next.14

4 years ago

9.0.0-next.13

4 years ago

8.2.6

4 years ago

8.2.5

4 years ago

9.0.0-next.9

4 years ago

9.0.0-next.8

4 years ago

9.0.0-next.7

4 years ago

9.0.0-next.6

5 years ago

9.0.0-next.5

5 years ago

9.0.0-next.3

5 years ago

9.0.0-next.2

5 years ago

9.0.0-next.1

5 years ago

9.0.0-next.0

5 years ago

8.1.1

5 years ago

8.1.0

5 years ago

8.0.0-rc.1

5 years ago

8.0.0-rc.0

5 years ago

8.0.0-beta.0

5 years ago

7.1.1

5 years ago

7.1.0

5 years ago

0.0.0

5 years ago

7.0.2

6 years ago

7.0.1

6 years ago

7.0.0

6 years ago

7.0.0-rc.0

6 years ago

6.1.0

6 years ago

6.0.0

6 years ago