ng-chat
ng-chat copied to clipboard
enable option window in user chat
Hi I want to use group option. but not able to use it. tried from reference/sample. but, not got success.
Also, want to use custom theme. Let me know how can i do this....
Hi @ssubham ,
For a group adapter example, you can check it out over here: https://github.com/rpaschoal/ng-chat-netcoreapp/blob/master/NgChatClient/ClientApp/src/app/signalr-group-adapter.ts
The above is the source code used by the demo.
For a custom theme, you will need to pass a valid asset URL to customTheme
as described on the docs, and your CSS should start with a custom-theme
selector. You can customize the same items as seen on these 2 pre-built themes:
https://github.com/rpaschoal/ng-chat/blob/master/src/ng-chat/assets/themes/ng-chat.theme.default.scss
https://github.com/rpaschoal/ng-chat/blob/master/src/ng-chat/assets/themes/ng-chat.theme.dark.scss
Want this option to enable.
Have found one issue. When, i send a message to an user first time. the chat window got open on recipient but, the message does not shown there.
@ssubham, to enable Groups , you need these steps:
-
implement the IChatGroupAdapter interface in your adapter (eg. SocketIOAdapter.ts)
-
specify the [groupAdapter] attribute in
The examples are clear on the above points, the missing link is on the server side. Chat Participants must have a 'participantType' = ChatParticipantType.User
-
If you are running the ng-chat-nodejs example, go into server.js and
socket.on('join', function(username) { // Same contract as ng-chat.User usersCollection.push({ participant: { id: socket.id, // Assigning the socket ID as the user ID in this example displayName: username, status: 0, // ng-chat UserStatus.Online, avatar: null, participantType: 0 //ChatParticipantType.User } }); .....
Hope this helps, Beemer
@buymybm100 You saved me. Thanks mate.