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
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.
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",
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 ?
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
An Irish coder. That's refreshing.
Hello Sir I'm getting error at this.socket = io(environment.wsUrl); saying The function is not callable please guide me thankx
Same here. Have you found the solution yet?
because you have to write the url in the environment file
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
Im getting an error saying 'wsService.connect(...).map is not a function' when trying to run it
import { map } from 'rxjs/operators'; then instead of .map use map without the dot
Also you may need to use .pipe() around the map, e.g:
.pipe(map((response: any): any => {
console.log(response);
return response;
})) as Subject;
how do you make it work on AWS elastic beanstalk? it only works locally for me. thanks.
hey my observable falls into infinite loop of getting http request what should i do? can anyone help!!!
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.
I always get client disconnected problem from backend side. the socket never connects
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",
thanks man
Can I Use Angular and MongoDB using Socket.io?
I want my database to be synchronous
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 ?
Thank you!!!!
Any time! :)
hey can you make video on chat app using this!
simply thanks..!!!!
it's verry good.
But i have error like this:
Property 'map' does not exist on type 'Subject'.
idea, please?
same here @mnd do you got any solution?
When using rxjs 6 look at: stackoverflow.com/questions/50203241/angular-5-to-6-upgrade-property-map-does-not-exist-on-type-observable
this.messages = wsService
.connect().pipe(
map((response: any): any => {
return response;
})
);
don't forget
import { map } from 'rxjs/operators';
@@bronco_fv I'll never understand why they changed the .map method instead of just changing it's function.
hi Rx.Subject is not resolving. what should i do
import it like that: import {Subject} from 'rxjs'; and then refer to it as Subject , not Rx.Subject
Can angular use websocket and connect to a php file in the server?
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
You need to add the property ws_url to your environment.ts file like shown at 10:14
Import TS correcting -----> import { environment } from './../../environments/environment';
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.
How did you handle it?
@@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);
}
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';
"property ws_url does not exist on type" error
Import TS correcting -----> import { environment } from './../../environments/environment';
where i need to add that main.js file
How do you host the server part (app.js)
you can't create server using angular .you can use node js, .net,java,python etc
consider avoid using import * from rxjs/Rx
reference: github.com/angular/angular/issues/20349