Can't connect to my WebSocket from within my Angular2 app

Discussão em 'Angular' iniciado por Sommereder, Julho 3, 2025.

  1. Sommereder

    Sommereder Guest

    I have a app using Node.js/Electron/Angular2 (TypeScript). Using socket.io I created a WebSocket. Everything works fine, as long as I'm not inside my Angular2 app.

    I tried the whole day to get this running, without luck. I downloaded a working tutorial, but can't find the missing link. Drives me crazy!

    • This is my electron.js starting the app, creating the websocket server side
    • This is my index.html with working websocket, but as native JavaScript code
    • This is my root component of Angular2 trying to get the websocket running

    The error - which does not stop the compilation - I get, is root.component.ts(14,17): error TS2304: Cannot find name 'io'..

    How can I get rid of that error? Or better: What's the best practice for this websocket communication inside Angular2?

    Thanks in advance.

    Continue reading...

Compartilhe esta Página