Angular Socket.IO Tutorial

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 43

  • @hardikrajpal2410
    @hardikrajpal2410 3 года назад

    An Irish coder. That's refreshing.

  • @bilalahmad5662
    @bilalahmad5662 3 года назад +3

    Hello Sir I'm getting error at this.socket = io(environment.wsUrl); saying The function is not callable please guide me thankx

    • @Angeck
      @Angeck 3 года назад

      Same here. Have you found the solution yet?

    • @edisonagamba
      @edisonagamba 3 года назад

      because you have to write the url in the environment file

  • @doomexe
    @doomexe 3 года назад

    Rx.subject.create is deprecated, what would I use instead? Looking into this it seems what was being created was an AnonymousSubject and subject.create should be replaced with new Subject() but replacing the line with `return new AnonymousSubject(observer, observable)` or `return new Subject(observer, observable)` cause an error

  • @LiorGroove
    @LiorGroove 6 лет назад +7

    Im getting an error saying 'wsService.connect(...).map is not a function' when trying to run it

    • @sebastiangug8284
      @sebastiangug8284 6 лет назад +4

      import { map } from 'rxjs/operators'; then instead of .map use map without the dot

    • @MrGamer-gx3sp
      @MrGamer-gx3sp 4 года назад +1

      Also you may need to use .pipe() around the map, e.g:
      .pipe(map((response: any): any => {
      console.log(response);
      return response;
      })) as Subject;

  • @carlosfrancisco9645
    @carlosfrancisco9645 3 года назад

    how do you make it work on AWS elastic beanstalk? it only works locally for me. thanks.

  • @kajalchauhan8054
    @kajalchauhan8054 5 лет назад +1

    hey my observable falls into infinite loop of getting http request what should i do? can anyone help!!!

  • @pawansaini260
    @pawansaini260 5 лет назад

    I have some diff use of socket. I want to get data from server and broadcast into our whole application using eventemitter but not working i tried alot can you help here. Only one component can receive data at a time if tried to receive on other component then data will stop on last component.

  • @pratikagarwal7210
    @pratikagarwal7210 3 года назад

    I always get client disconnected problem from backend side. the socket never connects

  • @jurvanoerle2845
    @jurvanoerle2845 5 лет назад +1

    For anyone that had the same error like me:
    Rx has no exported member subject, check out github.com/tiaguinho/material-community-components/issues/42.
    run npm install rxjs-compat and make sure it has the same version as rxjs, so your package.json looks like:
    "rxjs": "6.3.3",
    "rxjs-compat": "6.3.3",

  • @hrpcomapnyfirebase67
    @hrpcomapnyfirebase67 6 лет назад

    Can I Use Angular and MongoDB using Socket.io?
    I want my database to be synchronous

  • @giannosfor
    @giannosfor 6 лет назад

    This might sounds minor but why are you not using semicolons ? 5:00 Moreover is it a coding style of yours placing a comma in the end of the object literal constructor ?

  • @psybercity
    @psybercity 6 лет назад +1

    Thank you!!!!

  • @kajalchauhan8054
    @kajalchauhan8054 5 лет назад +1

    hey can you make video on chat app using this!

  • @carlosraulgregorioabreuter2071
    @carlosraulgregorioabreuter2071 5 лет назад

    simply thanks..!!!!

  • @mnd3716
    @mnd3716 6 лет назад

    it's verry good.
    But i have error like this:
    Property 'map' does not exist on type 'Subject'.
    idea, please?

    • @tanverzaman
      @tanverzaman 6 лет назад

      same here @mnd do you got any solution?

    • @bronco_fv
      @bronco_fv 6 лет назад +1

      When using rxjs 6 look at: stackoverflow.com/questions/50203241/angular-5-to-6-upgrade-property-map-does-not-exist-on-type-observable

    • @bronco_fv
      @bronco_fv 6 лет назад +5

      this.messages = wsService
      .connect().pipe(
      map((response: any): any => {
      return response;
      })
      );
      don't forget
      import { map } from 'rxjs/operators';

    • @coreytrowbridge2612
      @coreytrowbridge2612 5 лет назад

      @@bronco_fv I'll never understand why they changed the .map method instead of just changing it's function.

  • @kingsquad327
    @kingsquad327 5 лет назад

    hi Rx.Subject is not resolving. what should i do

    • @PazzaPolacca
      @PazzaPolacca 5 лет назад

      import it like that: import {Subject} from 'rxjs'; and then refer to it as Subject , not Rx.Subject

  • @Gol_D_Roger_The_Pirate_King
    @Gol_D_Roger_The_Pirate_King 6 лет назад

    Can angular use websocket and connect to a php file in the server?

  • @stevengiraldo3131
    @stevengiraldo3131 6 лет назад

    on the line 15 of the service "websocket.service.ts" there are an error:
    [ts] Property 'ws_url' does not exist on type '{ production: boolean; }'.
    ....how solve it please

    • @arronburch1333
      @arronburch1333 6 лет назад

      You need to add the property ws_url to your environment.ts file like shown at 10:14

    • @Piroft
      @Piroft 5 лет назад

      Import TS correcting -----> import { environment } from './../../environments/environment';

  • @bitard3d
    @bitard3d 5 лет назад

    Very useful tutorial, thank you very very much! There are some differences with RxJS 5 and 6 (i'm using angular 7.x), but i handled it.

    • @none0n
      @none0n 5 лет назад

      How did you handle it?

    • @bitard3d
      @bitard3d 5 лет назад

      @@none0n import { Observable, Subject, from } from 'rxjs';
      getOrderList() : Observable {
      //let orderList = [];
      let observer = {
      next: (data: Object) => {
      //console.log(data);
      },
      };
      let observable = new Observable((observer)=>{
      this.socket.on('message',(data) =>{
      observer.next(data);
      })
      return ()=>{
      this.socket.disconnect();
      }
      });
      return Subject.create(observer, observable);
      }

    • @Piroft
      @Piroft 5 лет назад

      Angular 8
      chatservice.ts
      import { Observable, Subject } from 'rxjs';
      import { map } from 'rxjs/operators';
      map((response: any): any => {
      return response;
      })
      app.component.ts
      import { Observable } from 'rxjs';
      import { environment } from './../../environments/environment';
      import {Subject} from 'rxjs';

  • @aayushbhargava022
    @aayushbhargava022 5 лет назад +1

    "property ws_url does not exist on type" error

    • @Piroft
      @Piroft 5 лет назад

      Import TS correcting -----> import { environment } from './../../environments/environment';

  • @divyasripantangi7869
    @divyasripantangi7869 6 лет назад

    where i need to add that main.js file

  • @avankait6796
    @avankait6796 6 лет назад

    How do you host the server part (app.js)

    • @TheParikshitsharma
      @TheParikshitsharma 6 лет назад

      you can't create server using angular .you can use node js, .net,java,python etc

  • @tonylu8086
    @tonylu8086 5 лет назад

    consider avoid using import * from rxjs/Rx
    reference: github.com/angular/angular/issues/20349