1.3.21 • Published 4 years ago

teamtalk-web-client v1.3.21

Weekly downloads
-
License
WTFPL
Repository
-
Last release
4 years ago

TeamTalk Web Client

Examples & Demos

A Simple Example.

How to use

Login

// with ES6 import
import socket from 'teamtalk-web-client';

const user = {
  url: 'ws://10.0.59.26:8001',
  userId: 502,
  userToken: 'xxxxxxxxxxx',
  appId: 3,
  domainId: 1000
}
socket.login(user).then(res => {
  // login success
}).catch(err => [
  // lgoin failed
])

socket.on('open', () => {
  //
})

Send and Receive Message

// Send Message to sessionId
// localId = new Date().getTime()
socket.sendMessage(sessionId, text, localId, sessionType);

// Receive New Message
socket.on('message', (data) => {
  console.log('message', data)
})

// Get Message List
let data = await socket.getMsgList(sessionId, sessionType, latestMsgId, count)

// Typing event
socket.on('remote.typing', () => {
  console.log('remote.typing')
})

// Start Typing and Stop Typing
socket.emit('client.start.typing', () => {
  console.log('client.start.typing')
})
socket.emit('client.stop.typing', () => {
  console.log('client.stop.typing')
})

// Ping and Pong
socket.on('ping', () => {
  console.log('ping')
})
socket.on('pong', () => {
  console.log('pong')
})

TODO

  • typescript interface: Message/userInfo/MsgType/...
  • session list user online status
  • [] (No plan) retry when message sent failed
  • [] kick off by server
  • support send image
  • [] (No plan) support audio message(Send/Receive/Play)
  • support remove session
  • add contact list (friend)
  • get user info from api
  • support custom message type = 3 (good card)
  • Component-based examples
  • get login user info
  • Promise-based WebSocket Client
  • loading more messages
  • login and get the socket url
  • open new chat by user ID
  • [] support send goods card
  • [] local message store(indexDB)
  • mark message as read
1.3.21

4 years ago

1.3.20

4 years ago

1.3.19

4 years ago

1.3.18

4 years ago

1.3.17

4 years ago

1.3.16

4 years ago

1.3.15

4 years ago

1.3.14

4 years ago

1.3.13

4 years ago

1.3.12

4 years ago

1.3.11

4 years ago

1.3.10

4 years ago

1.3.9

5 years ago

1.3.8

5 years ago

1.3.7

5 years ago

1.3.6

5 years ago

1.3.5

5 years ago

1.3.4

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago