2.0.0 • Published 11 months ago

phecda-client-ws v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

phecda-client-ws

client to request phecda-server-ws

install

npm i phecda-client-ws

quick start

in vite.config.ts

import { defineConfig } from 'vite'
import plugin from 'phecda-client/vite'

export default defineConfig({

  plugins: [plugin()],

})

create client and request to server

import { createClient } from 'phecda-client-ws'
import { TestWs } from '../server/test.ws'// it will redirect to .ps/ws.js
const ws = new WebSocket('ws://localhost:3001')
const client = createClient(ws, {
  test: TestWs,
}, {
  test(data) {
    console.log(data)
  },
})

ws.onopen = () => {
  console.log('open!')
  client.test.add({ name: 'ws' })
}
2.0.0

11 months ago

1.1.0

1 year ago

1.0.0

1 year ago