A simple, fun, fully asynchronous web socket & http server
curl -fsSL https://bun.com/install | bash # install bun
bun i -g @bsgbryan/jyn # install jyn globallyjyn # run jynThat's it. Really.
For command options, execute jyn --help
jyn is built on Mädūl. It bootstraps and invokes the madul specified by the madul property of the JSON web socket request, executes the default export, and returns the results.
What does this look like in practice?
bun init jyn_test- Add
"paths": { "+*": ["./*"] }to the end of thecompilerOptionssection of the newly-createdjyn_test/tsconfig.json bun i -g wscatjynecho 'export default ({ message: { name }, session_id }) => postMessage({content: `Hello ${name}!`, session_id, format: "TEXT"})\n' > ./greet.tswscat -c ws://localhost:1138{"madul": "+greet", "content": {"name": "World"}}
Which produces the response {"format":"TEXT","content":"Hello World!"}
Because it's awesome. It's super-fast, fun to work with, and comes with a ton of great tooling out-of-the-box.
Would you like to know more?