import { send, App } from './mod.ts'
Deno.test('send', async (t) => {
await t.step('should send a message with websocket', async () => {
const app = new App()
await app.listen({ port: 8881, hostname: 'localhost' })
const socket = new WebSocket('ws://localhost:8881')
socket.onopen = () => {
send(socket, { hello: 'world' })
socket.close()
app.close()
}
})
})
import { send, App } from './mod.ts'
Deno.test('send', async (t) => {
await t.step('should send a message with websocket', async () => {
const app = new App()
await app.listen({ port: 8881, hostname: 'localhost' })
const socket = new WebSocket('ws://localhost:8881')
socket.onopen = () => {
send(socket, { hello: 'world' })
socket.close()
app.close()
}
})
})