-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Zvicii edited this page Oct 28, 2021
·
11 revisions
If you are using node-nim under node enviroment or electron lower than 12.x.y, you will need the following tools to build addon locally, see here.
node-nim runs on Node.js and is available as a NPM package.
npm install node-nim --save-dev
Execute following script to run unit test, check this, and you can also get an coverage report under 'coverage'.
npm run coverage
const NIM = require('node-nim')
const assert = require('assert')
const result = NIM.Client.init('app_key', 'app_data_dir', 'app_install_dir', {
db_encrypt_key: 'abcdefghijklmnopqrstuvwxyz012345'
})
NIM.Client.login('app_key', 'username', 'password_in_md5', (result) => {
assert.strictEqual(result.err_code, 200)
}, '')
NIM.Talk.initEventHandler() // init callbacks
NIM.Talk.on('onReceiveMsg', function (result) {
console.log(result)
})
NIM.Talk.sendMsg({
to_type: 0, // p2p
to_accid: 'receiver_accid',
time: new Date().getTime(),
msg_type: 0, // text message
msg_body: 'Send from NIM node quick start.',
client_msg_id: new Date().getTime().toString(), // use an uuid
}, '', function () { })
NIM.Client.logout(1, (err_code) => {
assert.strictEqual(err_code, 200)
}, '')
NIM.Client.cleanUp('')
For more detailed documentation, the changelog, and tech support, see https://dev.yunxin.163.com/.
Script 'install' will build addon from source automatically if downloading pre-built addon from yunxin server failed(bad connection/lack of certain version/etc). You can also build addon manully, just type in the following command and run.
npm run build
- chatroom/chatroom
- chatroom_def/chatroom_def
- nim/client
- nim/data_sync
- nim/friend
- nim/global
- nim/msglog
- nim/nos
- nim/online_session
- nim/pass_through_proxy
- nim/plugin
- nim/session
- nim/subscribe_event
- nim/super_team
- nim/sysmsg
- nim/talk
- nim/talkex
- nim/team
- nim/tool
- nim/user
- nim_def/client_def
- nim_def/data_sync_def
- nim_def/doc_trans_def
- nim_def/friend_def
- nim_def/global_def
- nim_def/msglog_def
- nim_def/nos_def
- nim_def/online_session_def
- nim_def/pass_through_proxy_def
- nim_def/plugin_def
- nim_def/session_def
- nim_def/subscribe_event_def
- nim_def/super_team_def
- nim_def/sysmsg_def
- nim_def/talk_def
- nim_def/talkex_def
- nim_def/team_def
- nim_def/tool_def
- nim_def/user_def
- node-nim
- qchat/attachment
- qchat/channel
- qchat/channel_category
- qchat/instance
- qchat/message
- qchat/role
- qchat/server
- qchat/system_notification
- qchat_def/attachment_def
- qchat_def/channel_def
- qchat_def/instance_def
- qchat_def/message_def
- qchat_def/public_def
- qchat_def/role_def
- qchat_def/server_def
- qchat_def/system_notification_def