@act/ws

Web socket tools for Act

Usage no npm install needed!

<script type="module">
  import actWs from 'https://cdn.skypack.dev/@act/ws';
</script>

README

Act
A simple reactive front-end framework

 


Act ws

Act ws hello world:

import main from '@act/main'
import fromSocket from '@act/ws/fromSocket'

const socket = fromSocket('ws://socket-server.com')

const view = (model) =>
  ['main', [
    ['button', { click: socket.emit('ping') }, 'Ping']
    model
  ]]

const subscriptions = { pong: socket.on('pong') }

main(view, { model: 'No pong yet', subscriptions })

More

The documentation for this module is part of Act's docs.