Initial commit: MVP+ wish board with FastAPI + Tailwind
This commit is contained in:
commit
cd945a6128
2277 files changed
+843095
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-present Guillermo Rauch and Socket.IO contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+158
@@ -0,0 +1,158 @@
|
||||
|
||||
# engine.io-parser
|
||||
|
||||
[](https://github.com/socketio/engine.io-parser/actions)
|
||||
[](https://npmjs.com/package/engine.io-parser)
|
||||
|
||||
This is the JavaScript parser for the engine.io protocol encoding,
|
||||
shared by both
|
||||
[engine.io-client](https://github.com/socketio/engine.io-client) and
|
||||
[engine.io](https://github.com/socketio/engine.io).
|
||||
|
||||
## How to use
|
||||
|
||||
### Standalone
|
||||
|
||||
The parser can encode/decode packets, payloads, and payloads as binary
|
||||
with the following methods: `encodePacket`, `decodePacket`, `encodePayload`,
|
||||
`decodePayload`.
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
const parser = require("engine.io-parser");
|
||||
const data = Buffer.from([ 1, 2, 3, 4 ]);
|
||||
|
||||
parser.encodePacket({ type: "message", data }, encoded => {
|
||||
const decodedData = parser.decodePacket(encoded); // decodedData === data
|
||||
});
|
||||
```
|
||||
|
||||
### With browserify
|
||||
|
||||
Engine.IO Parser is a commonjs module, which means you can include it by using
|
||||
`require` on the browser and package using [browserify](http://browserify.org/):
|
||||
|
||||
1. install the parser package
|
||||
|
||||
```shell
|
||||
npm install engine.io-parser
|
||||
```
|
||||
|
||||
1. write your app code
|
||||
|
||||
```js
|
||||
const parser = require("engine.io-parser");
|
||||
|
||||
const testBuffer = new Int8Array(10);
|
||||
for (let i = 0; i < testBuffer.length; i++) testBuffer[i] = i;
|
||||
|
||||
const packets = [{ type: "message", data: testBuffer.buffer }, { type: "message", data: "hello" }];
|
||||
|
||||
parser.encodePayload(packets, encoded => {
|
||||
parser.decodePayload(encoded,
|
||||
(packet, index, total) => {
|
||||
const isLast = index + 1 == total;
|
||||
if (!isLast) {
|
||||
const buffer = new Int8Array(packet.data); // testBuffer
|
||||
} else {
|
||||
const message = packet.data; // "hello"
|
||||
}
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
1. build your app bundle
|
||||
|
||||
```bash
|
||||
$ browserify app.js > bundle.js
|
||||
```
|
||||
|
||||
1. include on your page
|
||||
|
||||
```html
|
||||
<script src="/path/to/bundle.js"></script>
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
- Runs on browser and node.js seamlessly
|
||||
- Runs inside HTML5 WebWorker
|
||||
- Can encode and decode packets
|
||||
- Encodes from/to ArrayBuffer or Blob when in browser, and Buffer or ArrayBuffer in Node
|
||||
|
||||
## API
|
||||
|
||||
Note: `cb(type)` means the type is a callback function that contains a parameter of type `type` when called.
|
||||
|
||||
### Node
|
||||
|
||||
- `encodePacket`
|
||||
- Encodes a packet.
|
||||
- **Parameters**
|
||||
- `Object`: the packet to encode, has `type` and `data`.
|
||||
- `data`: can be a `String`, `Number`, `Buffer`, `ArrayBuffer`
|
||||
- `Boolean`: binary support
|
||||
- `Function`: callback, returns the encoded packet (`cb(String)`)
|
||||
- `decodePacket`
|
||||
- Decodes a packet. Data also available as an ArrayBuffer if requested.
|
||||
- Returns data as `String` or (`Blob` on browser, `ArrayBuffer` on Node)
|
||||
- **Parameters**
|
||||
- `String` | `ArrayBuffer`: the packet to decode, has `type` and `data`
|
||||
- `String`: optional, the binary type
|
||||
|
||||
- `encodePayload`
|
||||
- Encodes multiple messages (payload).
|
||||
- If any contents are binary, they will be encoded as base64 strings. Base64
|
||||
encoded strings are marked with a b before the length specifier
|
||||
- **Parameters**
|
||||
- `Array`: an array of packets
|
||||
- `Function`: callback, returns the encoded payload (`cb(String)`)
|
||||
- `decodePayload`
|
||||
- Decodes data when a payload is maybe expected. Possible binary contents are
|
||||
decoded from their base64 representation.
|
||||
- **Parameters**
|
||||
- `String`: the payload
|
||||
- `Function`: callback, returns (cb(`Object`: packet, `Number`:packet index, `Number`:packet total))
|
||||
|
||||
## Tests
|
||||
|
||||
Standalone tests can be run with `npm test` which will run the node.js tests.
|
||||
|
||||
Browser tests are run using [zuul](https://github.com/defunctzombie/zuul).
|
||||
(You must have zuul setup with a saucelabs account.)
|
||||
|
||||
You can run the tests locally using the following command:
|
||||
|
||||
```
|
||||
npm run test:browser
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
The support channels for `engine.io-parser` are the same as `socket.io`:
|
||||
- irc.freenode.net **#socket.io**
|
||||
- [Github Discussions](https://github.com/socketio/socket.io/discussions)
|
||||
- [Website](https://socket.io)
|
||||
|
||||
## Development
|
||||
|
||||
To contribute patches, run tests or benchmarks, make sure to clone the
|
||||
repository:
|
||||
|
||||
```bash
|
||||
git clone git://github.com/socketio/engine.io-parser.git
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
cd engine.io-parser
|
||||
npm ci
|
||||
```
|
||||
|
||||
See the `Tests` section above for how to run tests before submitting any patches.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "engine.io-parser",
|
||||
"description": "Parser for the client for the realtime Engine",
|
||||
"license": "MIT",
|
||||
"version": "5.2.3",
|
||||
"main": "./build/cjs/index.js",
|
||||
"module": "./build/esm/index.js",
|
||||
"exports": {
|
||||
"import": "./build/esm/index.js",
|
||||
"require": "./build/cjs/index.js"
|
||||
},
|
||||
"types": "build/esm/index.d.ts",
|
||||
"devDependencies": {
|
||||
"prettier": "^3.3.2"
|
||||
},
|
||||
"scripts": {
|
||||
"compile": "rimraf ./build && tsc && tsc -p tsconfig.esm.json && ./postcompile.sh",
|
||||
"test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi",
|
||||
"test:node": "nyc mocha -r ts-node/register test/index.ts",
|
||||
"test:browser": "zuul test/index.ts --no-coverage",
|
||||
"format:check": "prettier --check 'lib/**/*.ts' 'test/**/*.ts'",
|
||||
"format:fix": "prettier --write 'lib/**/*.ts' 'test/**/*.ts'",
|
||||
"prepack": "npm run compile"
|
||||
},
|
||||
"homepage": "https://github.com/socketio/socket.io/tree/main/packages/engine.io-parser#readme",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/socketio/socket.io.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/socketio/socket.io/issues"
|
||||
},
|
||||
"files": [
|
||||
"build/"
|
||||
],
|
||||
"browser": {
|
||||
"./test/node": "./test/browser",
|
||||
"./build/esm/encodePacket.js": "./build/esm/encodePacket.browser.js",
|
||||
"./build/esm/decodePacket.js": "./build/esm/decodePacket.browser.js",
|
||||
"./build/cjs/encodePacket.js": "./build/cjs/encodePacket.browser.js",
|
||||
"./build/cjs/decodePacket.js": "./build/cjs/decodePacket.browser.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user