nuxt-plugins-grpc-web-client-stream

    2.0.9 • Public • Published

    nuxt-plugins-grpc-web-client-stream


    Install

    npm i nuxt-plugins-grpc-web-client-stream

    Props

    service request grpc metadata (选填) host

    Usage

    import subscribeEvents from 'nuxt-plugins-grpc-web-client-stream'
    async beforeStream() {
         let host = 'https://dengji.wenjuant.com'
         try {
           await subscribeEvents(
             {
               service: CaseMgm.SubscribeEvent,
               SubscribeEventRequest,
               grpc,
               host,
             },
             {
               onMsgFun: this.onMsgFun,
               onUnknownFun: this.onUnknownFun,
             }
           )
         } catch (error) {
           if (error.status) {
             console.log('重连失败,请检查网络链接!')
           }
         }
       },
       onMsgFun(val) {
         console.log(val, '这是接收长链接返回信息的位置')
       },
       onUnknownFun(val) {
         this.notify({
           content: '由于长时间未执行操作,与服务器的链接已断开!',
           type: 'error',
         })
       }

    Install

    npm i nuxt-plugins-grpc-web-client-stream

    DownloadsWeekly Downloads

    9

    Version

    2.0.9

    License

    MIT

    Unpacked Size

    4.14 kB

    Total Files

    3

    Last publish

    Collaborators

    • zzuzcy