Git Product home page Git Product logo

Comments (5)

satouriko avatar satouriko commented on June 11, 2024 1

唔……有毒的命名(

from node-cq-websocket.

momocow avatar momocow commented on June 11, 2024

我還真沒有在前端的環境測試過, 不過這個包並沒有依賴任何OS的東西, 理論上可以在 JS 環境中使用
依賴的 websocket 包也說明他們支援各大瀏覽器 (參考連結)

Uncaught TypeError: $WebsocketClient is not a constructor

這個原因極有可能是因為 $WebsocketClient 裡面是個 undefined

想請問你如何在 js 中使用這個包的? 是否使用 webpack ?

from node-cq-websocket.

satouriko avatar satouriko commented on June 11, 2024

deprecate WebSocket-Node and use ws should solve this problem.

from node-cq-websocket.

momocow avatar momocow commented on June 11, 2024

In docs of ws, it says

Note: This module does not work in the browser. The client in the docs is a reference to a back end with the role of a client in the WebSocket communication. Browser clients must use the native WebSocket object.

However, WebSocket-Node has already supported to run on browsers. See here.

All current browsers are fully supported.

Firefox 7-9 (Old) (Protocol Version 8)
Firefox 10+ (Protocol Version 13)
Chrome 14,15 (Old) (Protocol Version 8)
Chrome 16+ (Protocol Version 13)
Internet Explorer 10+ (Protocol Version 13)
Safari 6+ (Protocol Version 13)

I think WebSocket-Node is still the right choice for this SDK.

In order to support running on browsers, in his case, Webpack is required to bundle those dependencies.
(Or just use native Websocket instead!)

from node-cq-websocket.

momocow avatar momocow commented on June 11, 2024

這帖之後就在 #9 追蹤。

from node-cq-websocket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.