1.1.2 • Published 3 years ago

as-websocket v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

As-WebSocket

WebSocket bindings for AssemblyScript

Setting up

Add --exportTable and --exportRuntime flags

+ const asWebSocket = require('as-websocket')

+ const ws = new asWebSocket()

const imports = {
    ...ws.wasmImports
}

const wasmModule = loader.instantaniateSync()

+ ws.wasmExports = wasmModule.exports

Usage

AssemblyScript WebSocket

import { WebSocket } from 'as-ws'

const socket = new WebSocket('ws://localhost:3000')

socket.on('message', (data) => {

    console.log('Message: ' + data)

})

socket.on('listening', () => {

    console.log('Listening')

})

socket.send('Hello From AssemblyScript!')

Browser

<script src="https://unpkg.com/as-websocket@latest/browser.js"></script>
1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.7

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago