Adding support for join messages. Fixes #8
This commit is contained in:
parent
2295bd4d88
commit
fd43a890a7
6 changed files with 24 additions and 6 deletions
|
@ -55,6 +55,8 @@ import {
|
|||
SiteConfigForm,
|
||||
MarkAllAsReadForm,
|
||||
WebSocketJsonResponse,
|
||||
CommunityJoinForm,
|
||||
PostJoinForm,
|
||||
} from 'lemmy-js-client';
|
||||
import { UserService } from './';
|
||||
import { i18n } from '../i18next';
|
||||
|
@ -85,7 +87,7 @@ export class WebSocketService {
|
|||
this.ws = new ReconnectingWebSocket(wsUri, [], this.wsOptions);
|
||||
let firstConnect = true;
|
||||
|
||||
this.subject = Observable.create((obs: any) => {
|
||||
this.subject = new Observable((obs: any) => {
|
||||
this.ws.onmessage = e => {
|
||||
obs.next(JSON.parse(e.data));
|
||||
};
|
||||
|
@ -113,6 +115,14 @@ export class WebSocketService {
|
|||
this.ws.send(this.client.userJoin(form));
|
||||
}
|
||||
|
||||
public postJoin(form: PostJoinForm) {
|
||||
this.ws.send(this.client.postJoin(form));
|
||||
}
|
||||
|
||||
public communityJoin(form: CommunityJoinForm) {
|
||||
this.ws.send(this.client.communityJoin(form));
|
||||
}
|
||||
|
||||
public login(form: LoginForm) {
|
||||
this.ws.send(this.client.login(form));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue