angular - net::ERR_CONNECTION_TIMED_OUT on Socket.io in Ionic -
while serve app shows "get http://localhost:8080/socket.io/?eio=3&transport=polling&t=lu3rczm1 net::err_connection_timed_out "
import {navcontroller,navparams} ‘ionic-angular’; import { component,viewchild } ‘@angular/core’; import {showactionsheet} ‘…/…/components/show-action-sheet/show-action-sheet.component’; import * io “socket.io-client”; @component({ templateurl: ‘chat.html’ }) export class chatpage { socket: socketioclient.socket; params: any; chatbox:any; messages:array=[]; name:any; @viewchild(showactionsheet) private showactionsheet: showactionsheet; constructor(public nav: navcontroller, public navparams: navparams) { this.params = navparams; this.name = this.params.get(‘name’); } presentactionsheet(actionsheettype) { this.showactionsheet.presentactionsheet(actionsheettype); } private send(text){ this.connect(); this.chatbox=text; this.messages.push(this.chatbox); this.chatbox=''; } connect() { this.socket=io(‘http://localhost:8080’); this.socket.on(‘connect’, function () { console.log("socket connected"); }); } }
i have no idea why isn’t working. have installed typings.
Comments
Post a Comment