Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
EmberJS 4.2 + SocketIO 4 setup

In my application, when I refresh the page, sometime I can't able to get data with SocketIO.

I think the event emitter was triggered before socket connecting to server.

SocketIO Code:

import { io } from 'socket.io-client';

export default class SocketIoService extends Service {

  @action io() {
    return io('http://localhost:3030', {});
  }
}

Data receiving Code:

export default class DataService extends Service {
  @service('socket-io') socket;

  @tracked data;

  @action getData() {
    let socket = this.socket.io();

    socket.on('data-response', (data) => {
      this.data = data
    })

    socket.emit('data-request');
  }
}
Note: getData() will triggered in any route modal.

I'm new to EmberJS, I didn't find any latest class(oops) based example code.

Also suggest any boilerplate or open source with latest version please.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Issue was in server side... My full script is waiting to check authenticated user before listening to the event...

Now I handled and it is working fine....

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!