Skip to content

Commit

Permalink
Merge pull request #31 from kalm/v4.0.0
Browse files Browse the repository at this point in the history
V4.0.0
  • Loading branch information
fed135 authored Mar 28, 2020
2 parents 7240230 + ce6d1af commit 731491d
Show file tree
Hide file tree
Showing 38 changed files with 760 additions and 194 deletions.
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,18 @@ packages/tcp/bin
packages/udp/bin
packages/ws/bin
packages/webrtc/bin

# publish-only files
packages/kalm/LICENSE
packages/ipc/LICENSE
packages/tcp/LICENSE
packages/udp/LICENSE
packages/ws/LICENSE
packages/webrtc/LICENSE

packages/kalm/CHANGELOG.md
packages/ipc/CHANGELOG.md
packages/tcp/CHANGELOG.md
packages/udp/CHANGELOG.md
packages/ws/CHANGELOG.md
packages/webrtc/CHANGELOG.md
127 changes: 127 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Changelog

## [v3.3.0] - 2020-01-30

commit: [af46059](https://github.com/kalm/kalm.js/commit/af4605958c567b5243887f911850a3c0eb6c6659)

### Added
- Adds webrtc package and examples
- Adds the getChannels method on Client

### Removed
- Removed home implementation of EventEmitter in favor of Node's

## [v3.2.3] - 2020-01-14

commit: [c188225](https://github.com/kalm/kalm.js/commit/c18822532a49f2026eddf44cfbe3cfc1521110f8)

### Added
- Added pre-hook for lint on commit

### Changed
- Cleaned up Types management and typings file accessibility
- Migrated test suite to Jest and centralized test tooling
- Removed output rollup, and using only tsc with none modules
- Fixed linting (was not targeting .ts files properly)
- Fixed stats events (were previously unreachable, now exposed through client emitter as .*)
- Fixed timeout behavior (only logged, now actually disconnects)

## [v3.1.2] - 2019-07-01

commit: [fac8047](https://github.com/kalm/kalm.js/commit/fac8047d4b7048d56803505103159e16d8f518a8)

### Changed
- Changed dev tooling from lerna to yarn workspaces
- Changed dev tooling from tslint to eslint + @typescript-eslint
- Housekeeping

## [v3.0.0] - 2019-01-18

commit: [a4c687d](https://github.com/kalm/kalm.js/commit/a4c687dd5786a70723d9d0964a9d189220d58418)

### Added
- New monorepo structure
- Massive new changes to the interface

### Changed
- Serialization is now a toggle for json/binary
- Re-written the entire codebase in Typescript

### Removed
- Transports are no longer bundled and must be installed separately and must be instantiated with options.
- [ipc](https://www.npmjs.com/package/@kalm/ipc)
- [tcp](https://www.npmjs.com/package/@kalm/tcp)
- [udp](https://www.npmjs.com/package/@kalm/udp)
- [ws](https://www.npmjs.com/package/@kalm/ws)
- Profiles become routines and must be instantiated with options.
- No more session stores
- No more encryption

## [v2.6.1] - 2018-01-27

commit: [7393d17](https://github.com/kalm/kalm.js/commit/7393d17efb02088d7283ba83108fd7ab15e3d39e)

### Added
- Added package-lock.json file
- Added server reference in the client object

## [v2.5.0] - 2017-09-21

commit: [2c687f6](https://github.com/kalm/kalm.js/commit/2c687f6074787af6b39c10abe19669fe20e7b02d)

### Added
- Added engines reqs

### Changed
- Some minor performance tuning

## [v2.4.0] - 2017-09-01

commit: [a7b8f95](https://github.com/kalm/kalm.js/commit/a7b8f950da56cbe35c538dc02e3dcc0e6d3a3db3)

### Changed
- Tuned performances
- Added build targets for Node 8.x and 6.x
- UDP client cache (tied with socketTimeout)
- Bumped dependencies
- Proper callback on disconnect

### Removed
- Dropped support for Node 4.x

## [v2.3.0] - 2017-07-25

commit: [f323bcd](https://github.com/kalm/kalm.js/commit/f323bcdc163faa40b0f8515fd4a8759e5180f516)

### Added
- Added realtime profile
- Added JSDoc
- Added parameter validation and error messages

### Changed
- Better performances (3x with default congestion)

## [v2.2.0] - 2017-06-21

commit: [b9f3bdd](https://github.com/kalm/kalm.js/commit/b9f3bdd50de8dae2b92a0866d234a0cb2e72f22b)

### Added
- Added support for node 8

## [v2.1.0] - 2017-06-20

commit: [129146f](https://github.com/kalm/kalm.js/commit/129146feeab14e94a540a4d9c54e05a4614fdb39)

### Changed
- Simplified and optimized queue system logic
- Now allowing 0 to be passed as tick value in profiles
- Added warning when non-serialized message are sent and serial config is `null`
- Fixed hanging packets on maxBytes just reached

## [v2.0.0] - 2017-03-02

commit: [b5209ec](https://github.com/kalm/kalm.js/commit/b5209ec4d3ab86000b72b502d120f0a5b4da85af)

### Added
- Migrated the codebase from the [original repo](https://github.com/fed135/kalm)
- Implemeted new interface
9 changes: 0 additions & 9 deletions jest.config.js

This file was deleted.

36 changes: 21 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"lint": "eslint **/*.ts **/*.spec.ts",
"lint:fix": "yarn lint --fix",
"test": "jest ./packages && jest ./tests/integration --forceExit",
"test": "yarn workspaces run test && jest ./tests/integration --forceExit",
"build": "yarn workspaces run build",
"clean": "yarn workspaces run clean",
"bench": "node ./scripts/benchmarks"
Expand Down Expand Up @@ -39,23 +39,29 @@
"pre-commit": "yarn lint"
}
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"globals": {
"ts-jest": {
"diagnostics": false,
"isolatedModules": true
}
}
},
"devDependencies": {
"@types/jest": "^24.0.17",
"@types/node": "^13.1.0",
"@typescript-eslint/eslint-plugin": "^2.14.0",
"@typescript-eslint/parser": "^2.14.0",
"@types/jest": "^25.1.0",
"@types/node": "^13.9.0",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-plugin-import": "^2.19.0",
"husky": "^3.1.0",
"jest": "^24.9.0",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-plugin-import": "^2.20.0",
"husky": "^4.2.0",
"jest": "^25.1.0",
"socket.io": "^2.3.0",
"socket.io-client": "^2.3.0",
"ts-jest": "^24.2.0",
"typescript": "^3.7.4"
},
"dependencies": {
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
"ts-jest": "^25.2.0",
"typescript": "^3.8.0"
}
}
24 changes: 21 additions & 3 deletions packages/ipc/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# Kalm IPC (Inter-process-communication) transport
<h1 align="center">
<a title="The socket optimizer" href="http://kalm.js.org">
<img alt="Kalm" width="300px" src="https://kalm.js.org/images/kalmv3.png" />
<br/>
</a>
Kalm
</h1>
<h3 align="center">
The Socket Optimizer
<br/><br/>
</h3>
<br/>

[![Kalm](https://img.shields.io/npm/v/kalm.svg)](https://www.npmjs.com/package/@kalm/ipc)
[![Build Status](https://github.com/kalm/kalm.js/workflows/master-status/badge.svg)](https://github.com/kalm/kalm.js/actions?query=workflow%3A+master-status)
![Snyk Vulnerabilities for GitHub Repo](https://img.shields.io/snyk/vulnerabilities/github/kalm/kalm.js)
[![Financial Contributors on Open Collective](https://opencollective.com/kalm/all/badge.svg?label=financial+contributors)](https://opencollective.com/kalm)
[![Join the chat at https://gitter.im/KALM/home](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/KALM/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)


## Installing

Expand All @@ -8,8 +26,8 @@

```
{
socketTimeout = 30000,
path = '/tmp/app.socket-'
socketTimeout: 30000,
path: '/tmp/app.socket'
}
```

Expand Down
30 changes: 15 additions & 15 deletions packages/ipc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
"main": "bin/ipc.js",
"scripts": {
"build": "../../scripts/build.sh ipc",
"clean": "../../scripts/cleanup.sh"
"clean": "../../scripts/cleanup.sh",
"test": "jest ./tests",
"prepublish": "cp ../../LICENSE ./LICENSE && cp ../../CHANGELOG.md ./CHANGELOG.md"
},
"funding": {
"type": "Open Collective",
Expand All @@ -16,23 +18,11 @@
"url": "git+https://github.com/kalm/kalm-js.git"
},
"keywords": [
"multiplex",
"framework",
"network",
"optimize",
"realtime",
"socket",
"websocket",
"client",
"server",
"service",
"peer",
"micro",
"latency",
"messaging",
"queue",
"nagle",
"buffer",
"protocol",
"web",
"ipc"
],
"files": ["bin", "types.d.ts"],
Expand All @@ -49,5 +39,15 @@
"browser": {
"net": false,
"fs": false
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"globals": {
"ts-jest": {
"diagnostics": false,
"isolatedModules": true
}
}
}
}
6 changes: 3 additions & 3 deletions packages/ipc/src/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ interface IPCSocket extends net.Socket {
}
}

export function ipc({ socketTimeout = 30000, path = '/tmp/app.socket-' }: IPCConfig = {}): KalmTransport {
function ipc({ socketTimeout = 30000, path = '/tmp/app.socket-' }: IPCConfig = {}): KalmTransport {
return function socket(params: ClientConfig, emitter: NodeJS.EventEmitter): Socket {
let listener: net.Server;

Expand All @@ -25,8 +25,8 @@ export function ipc({ socketTimeout = 30000, path = '/tmp/app.socket-' }: IPCCon

function remote(handle: IPCSocket): Remote {
return {
host: handle._server._pipeName,
port: handle._handle.fd,
host: handle && handle._server && handle._server._pipeName || null,
port: handle && handle._handle && handle._handle.fd || null,
};
}

Expand Down
37 changes: 36 additions & 1 deletion packages/ipc/tests/unit/ipc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
import { EventEmitter } from 'events';
import * as ipc from '../../src/ipc';

describe('IPC transport', () => {
it('TODO', () => { expect(ipc).not.toBeUndefined(); });
it('basic setup', () => {
expect(typeof ipc.default).toBe('function');
const transport = ipc.default();
expect(typeof transport).toBe('function');
const socket = transport({}, new EventEmitter());

expect(socket).toHaveProperty('bind', expect.any(Function));
expect(socket).toHaveProperty('connect', expect.any(Function));
expect(socket).toHaveProperty('disconnect', expect.any(Function));
expect(socket).toHaveProperty('remote', expect.any(Function));
expect(socket).toHaveProperty('stop', expect.any(Function));
expect(socket).toHaveProperty('send', expect.any(Function));
});

describe('Given an empty handle reference and no configs', () => {
const transport = ipc.default();
const socket = transport({}, new EventEmitter());

describe('when fetching remote', () => {
it('should return null values', () => {
expect(socket.remote()).toEqual({ host: null, port: null });
});
});
});

describe('Given a handle reference and no configs', () => {
const transport = ipc.default();
const socket = transport({}, new EventEmitter());

describe('when fetching remote', () => {
it('should return handle\'s values', () => {
expect(socket.remote({ _server: { _pipeName: '/foo' }, _handle: { fd: 12345 } })).toEqual({ host: '/foo', port: 12345 });
});
});
});
});
Loading

0 comments on commit 731491d

Please sign in to comment.