Skip to content

Commit 21d9e9d

Browse files
authored
Merge pull request #10 from Tom32i/ws
Moved to ws package for Websocket implementation
2 parents 2264637 + 2c3146a commit 21d9e9d

File tree

16 files changed

+1190
-1166
lines changed

16 files changed

+1190
-1166
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Here we use a BinaryEncoder to communicate in binary over websocket, with the pr
5555

5656
```javascript
5757
import Server from 'netcode/src/server/Server';
58-
import BinaryEncoder from 'netcode/src/server/BinaryEncoder';
58+
import BinaryEncoder from 'netcode/src/encoder/BinaryEncoder';
5959
import events from './envents';
6060

6161
// Listen on localhost:8080
@@ -77,7 +77,7 @@ Now we write a client, for the browser, that connects to our running server on `
7777

7878
```javascript
7979
import Client from 'netcode/src/client/Client';
80-
import BinaryEncoder from 'netcode/src/client/BinaryEncoder';
80+
import BinaryEncoder from 'netcode/src/encoder/BinaryEncoder';
8181
import events from './envents';
8282

8383
const client = new Client('ws://localhost:8080', new BinaryEncoder(events))

demo-client.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
window.addEventListener('load', () => {
32
const { Client, BinaryEncoder, Codec, Int8Codec, Int16Codec, LongIntCodec, BooleanCodec, StringCodec } = netcode;
43

demo-server.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const encoder = new BinaryEncoder([
1111
]);
1212

1313
// Create the server
14-
const server = new Server(process.argv[2], 'localhost', encoder);
14+
const port = process.argv[2];
15+
const server = new Server(port, 'localhost', encoder, 10);
1516

1617
// Listen for new clients
1718
server.on('client:join', client => {

doc/packaging.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Now you can import source file from _netcode_ directly in your sources and it wi
6262
```javascript
6363
// src/server.js
6464
import Server from 'netcode/src/server/Server';
65-
import BinaryEncoder from 'netcode/src/server/BinaryEncoder'; // Import from src/server!
65+
import BinaryEncoder from 'netcode/src/encoder/BinaryEncoder';
6666
import { BooleanCodec } from 'netcode/src/encoder/codec';
6767
6868
new Server(
@@ -77,7 +77,7 @@ new Server(
7777
```javascript
7878
// src/client.js
7979
import Client from 'netcode/src/client/Client';
80-
import BinaryEncoder from 'netcode/src/client/BinaryEncoder'; // Import from src/client!
80+
import BinaryEncoder from 'netcode/src/encoder/BinaryEncoder';
8181
import { BooleanCodec } from 'netcode/src/encoder/codec';
8282
8383
new Client(

0 commit comments

Comments
 (0)