Git Product home page Git Product logo

Comments (7)

adzialocha avatar adzialocha commented on August 16, 2024

Thank you @rm8x!

What error does occur? I can't reproduce the problem, this here does not throw any errors in version 1.2.0:

const OSC = require('osc-js')

var plugin = new OSC.WebsocketClientPlugin({
  host: 'localhost',
  port: 44121,
})

const osc = new OSC({
  plugin,
})

from osc-js.

jarmitage avatar jarmitage commented on August 16, 2024

I have this error also when using the example here https://github.com/adzialocha/osc-js/wiki/Node.js-Server#websocket-server-example

from osc-js.

adzialocha avatar adzialocha commented on August 16, 2024

@jarmitage Are you sure you are using the right plugins? When working with the only browser version (for Webpack builds for exampe), the plugin is called WebsocketBrowserPlugin (which is also set by default), when working with the normal version it is WebsocketClientPlugin. @rm8x

Example using the browser version:

var osc = new OSC();

var plugin = new OSC.WebsocketBrowserPlugin({
  host: 'localhost',
  port: 44121,
})

osc.open({ plugin });

from osc-js.

adzialocha avatar adzialocha commented on August 16, 2024

I updated the Wiki (https://github.com/adzialocha/osc-js/wiki/Webpack-Bundling), maybe this point was too confusing before

from osc-js.

jarmitage avatar jarmitage commented on August 16, 2024

I get the same error (OSC.DatagramPlugin is not a constructor) when trying to run the UDP example (https://github.com/adzialocha/osc-js/wiki/Node.js-Server#udp-server-example)

I'm trying to do something equivalent to this: https://github.com/colinbdclark/osc.js-examples/tree/master/browser

from osc-js.

adzialocha avatar adzialocha commented on August 16, 2024

@jarmitage as long as you are using the browser version this wont work either (as mentioned only WebsocketBrowserPlugin is possible then). Please use the normal osc-js version if you want to work with UDP.

If the problem still occurs I would need more information (Webpack configuration, source code) to really help you

from osc-js.

gilfuser avatar gilfuser commented on August 16, 2024

Hi.
I'm getting similar erros as the described above. I'm going to give the information I think would be useful. Please tell me if there is something missing or if I can help somehow.

My particular case is an application made with Vue/Nuxt + express, and I'm following the osc-js-webpack-example.
I got errors both in the server and client sides.

In the client the error is this:

{ TypeError: __WEBPACK_IMPORTED_MODULE_5_osc_js___default.a is not a constructor
    at VueComponent.data (pages/index.1b33cb139b7bbca63b19.js:113:10)
    ...

The VueComponent.data points to where the new OSC() is.
The webpack.config is not exposed in Nuxt, but there is a nuxt.config from which one can configure Webpack, specifically in this part:

    extend(config, ctx) {

      config.resolve.alias['osc-js'] = path.resolve(__dirname, 'node_modules/osc-js/lib/osc.browser.js')

      // Run ESLint on save
      if (ctx.isDev && ctx.isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/,
        })
      }
    }

In the server side I'm getting this error:

const osc = new OSC({ plugin: new OSC.WebsocketServerPlugin() })
                               ^
TypeError: OSC.WebsocketServerPlugin is not a constructor

My package.json file is like so (thinking about what could be useful to understand what's going on):

{
  "name": "deslugar",
  "version": "1.0.0",
  "description": "non-local osc jam",
  "author": "Gil Fuser",
  "private": true,
  "scripts": {
    "dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
    "build": "nuxt build",
    "start": "cross-env NODE_ENV=production nodemon server/index.js",
    "generate": "nuxt generate",
    "lint": "eslint --ext .js,.vue --ignore-path .gitignore .",
    "precommit": "npm run lint"
  },
  "dependencies": {
    "@nuxtjs/axios": "^5.0.0",
    "express": "^4.15.3",
    "nuxt": "^1.0.0",
    "osc-js": "^1.2.2",
    "signalhub": "^4.9.0",
    "socket.io": "^2.1.1",
    "socket.io-client": "^2.1.1",
    "webrtc-swarm": "^2.9.0",
    "wrtc": "^0.2.0"
  },
  "devDependencies": {
    "ajv": "^6.5.3",
    "babel-eslint": "^8.2.1",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "cross-env": "^5.0.1",
    "eslint": "^4.19.1",
    "eslint-loader": "^2.0.0",
    "eslint-plugin-vue": "^4.0.0",
    "nodemon": "^1.11.0"
  }
}

... and and webpack version 3.12.0

I really like that project and would like to experiment and use osc-js, so, any help would be much appreciated.

best regards,
Gil

from osc-js.

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.