2019-11-25更新

npm install --save easemob-websdk
请直接使用官方安装方式即可。
import WebIM from 'easemob-websdk'

以下是最开始版本 环信不适配所写

配置文件可用下面的

使用时请仔细检查域名与host 是否是HTTP/HHTPS协议

// Step1、安装 easemob-websdk

// npm install --save easemob-websdk

// Step2、安装 strophe.js    underscore    crypto-js

// npm install --save strophe.js underscore crypto-js

Update 2019-6-19  更新  使用 hx-websdk

npm install --save hx-websdk

Step3、使用 新建一个webim.js

import store from '@/store'
// window.Strophe = require('strophe.js').Strophe // 务必在前面引入
// let WebIM = require('easemob-websdk')
let WebIM = require('hx-websdk') // 使用hx-websdk集成 直接使用 WebIM.config = {
/*
* XMPP server
*/
xmppURL: 'im-api.easemob.com',
/*
* Backend REST API URL
*/
apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//a1.easemob.com',
/*
* Application AppKey
*/
appkey: '你公司的环信AppKey', /*
* Whether to use wss
* @parameter {Boolean} true or false
*/
https: false,
/*
* isMultiLoginSessions
* true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
* false: A visitor can sign in to only one webpage and receive messages at the webpage.
*/
isMultiLoginSessions: false,
/*
* set presence after login
*/
isAutoLogin: true,
/**
* Whether to use window.doQuery()
* @parameter {Boolean} true or false
*/
isWindowSDK: false,
/**
* isSandBox=true: xmppURL: 'im-api-sandbox.easemob.com', apiURL: '//a1-sdb.easemob.com',
* isSandBox=false: xmppURL: 'im-api.easemob.com', apiURL: '//a1.easemob.com',
* @parameter {Boolean} true or false
*/
isSandBox: false,
/**
* Whether to console.log in strophe.log()
* @parameter {Boolean} true or false
*/
isDebug: true,
/**
* will auto connect the xmpp server autoReconnectNumMax times in background when client is offline.
* won't auto connect if autoReconnectNumMax=0.
*/
autoReconnectNumMax: 2,
/**
* the interval seconds between each auto reconnectting.
* works only if autoReconnectMaxNum >= 2.
*/
autoReconnectInterval: 2,
/**
* webrtc supports WebKit and https only
*/
isWebRTC: (/Firefox/.test(navigator.userAgent) || /WebKit/.test(navigator.userAgent)) && /^https:$/.test(window.location.protocol),
/**
* after login, send empty message to xmpp server like heartBeat every 45s, to keep the ws connection alive.
*/
heartBeatWait: 4500,
/**
* while http access,use ip directly,instead of ServerName,avoiding DNS problem.
*/
isHttpDNS: false, /**
* Will show the status of messages in single chat
* msgStatus: true show
* msgStatus: true hide
*/
msgStatus: true, /**
* When a message arrived, the receiver send an ack message to the
* sender, in order to tell the sender the message has delivered.
* See call back function onReceivedMessage
*/
delivery: true, /**
* When a message read, the receiver send an ack message to the
* sender, in order to tell the sender the message has been read.
* See call back function onReadMessage
*/
read: false, /**
* Will encrypt text message and emoji message
* {type:'none'} no encrypt
* {type:'base64'} encrypt with base64
* {type:'aes',mode: 'ebc',key: '123456789easemob',iv: '0000000000000000'} encrypt with aes(ebc)
* {type:'aes',mode: 'cbc',key: '123456789easemob',iv: '0000000000000000'} encrypt with aes(cbc)
*/
encrypt: {
type: 'none'
}
}
WebIM.Emoji = {
path: 'images/faces/',
map: {
'[):]': 'ee_1.png',
'[:D]': 'ee_2.png',
'[;)]': 'ee_3.png',
'[:-o]': 'ee_4.png',
'[:p]': 'ee_5.png',
'[(H)]': 'ee_6.png',
'[:@]': 'ee_7.png',
'[:s]': 'ee_8.png',
'[:$]': 'ee_9.png',
'[:(]': 'ee_10.png',
'[:\'(]': 'ee_11.png',
'[:|]': 'ee_12.png',
'[(a)]': 'ee_13.png',
'[8o|]': 'ee_14.png',
'[|]': 'ee_15.png',
'[+o(]': 'ee_16.png',
'[<o)]': 'ee_17.png',
'[|-)]': 'ee_18.png',
'[*-)]': 'ee_19.png',
'[:-#]': 'ee_20.png',
'[:-*]': 'ee_21.png',
'[^o)]': 'ee_22.png',
'[8-)]': 'ee_23.png',
'[(|)]': 'ee_24.png',
'[(u)]': 'ee_25.png',
'[(S)]': 'ee_26.png',
'[(*)]': 'ee_27.png',
'[(#)]': 'ee_28.png',
'[(R)]': 'ee_29.png',
'[({)]': 'ee_30.png',
'[(})]': 'ee_31.png',
'[(k)]': 'ee_32.png',
'[(F)]': 'ee_33.png',
'[(W)]': 'ee_34.png',
'[(D)]': 'ee_35.png'
}
}
WebIM.NewEmoji = {
map: ['

Vue 集成环信 全局封装环信WebSDK 可直接使用的更多相关文章

  1. vue集成环信IM

    vue 集成环信im 简单demo 环信AppKey:1106190415055331#test 测试账号: test1  123456  test2  123456  test3  123456 默 ...

  2. 李洪强iOS开发之-环信02.2_环信官网下载环信 SDK

    李洪强iOS开发之-环信02.2_环信官网下载环信 SDK 移动客服即时通讯云 iOS SDK 当前版本:V3.1.4 2016-07-08 [ 版本历史 ] | 开发指南 | 知识库 | Demo源 ...

  3. 李洪强iOS开发之-环信02.1_环信 SDK 2.x到3.0升级文档

    李洪强iOS开发之-环信02.1_环信 SDK 2.x到3.0升级文档 SDK 2.x 至 3.0 升级指南 环信 SDK 3.0 升级文档 3.0 中的核心类为 EMClient 类,通过 EMCl ...

  4. Android 环信(Android)设置头像和昵称的方法

    最近,经常有朋友问到,如何集成环信头像,怎么才能快速显示头像,因时间紧急,很多朋友都没有时间慢慢的研究代码,这里大家稍微花10分钟看一下文章,看完后再花5分钟改一下代码,即可达到你们所要的效果. 当然 ...

  5. 环信集成 2---基于环信Demo3.0,实现单聊功能

    这几天在做环信,所以把环信相关的东西拿过来,做个系统点的东西 注意: 这里Demo集成的是带有实时语音功能的(libEaseMobClientSDK.a). 环信库是直接拖拽EaseMobSDK文件夹 ...

  6. 李洪强iOS开发本人集成环信的经验总结_01环信SDK的导入

    李洪强iOS开发本人集成环信的经验总结_01环信SDK的导入 01 - 直接在项目中导入SDK和一些静态库 这个时候,没有错误的编译没有错误的话,就说明SDK已经配置成功 还有一种方法是用cocoap ...

  7. Apple Watch 集成环信SDK

    本文简单的讲述下怎样用Apple Watch Kit集成环信SDK. 升级xcode到version 6.2,和 IOS SDK8.2 下载环信SDK从官网 打开XCode->new proje ...

  8. iOS:集成环信EaseMobSDK单聊功能

    当然在集成环信之前需要一些准备操作: 1.首先注册环信开发者账号,直接进入环信官网注册即可:http://www.easemob.com 2.按照文档一步一步将需要的文件全部拖入工程中:http:// ...

  9. 李洪强iOS开发本人集成环信的经验总结_03_注册

    李洪强iOS开发本人集成环信的经验总结_03_注册 环信一共提供了三种注册的方法:  01 同步注册:  02 异步注册:  03 - 使用代理回调进行注册,但是3.0没有了,3.0之前有  调用注册 ...

随机推荐

  1. golang 使用编译选项-H=windowsgui后,仍然输出log到console

    大概原理: 略略略... if debug { modkernel32 := syscall.NewLazyDLL("kernel32.dll") procAllocConsole ...

  2. netty权威指南学习笔记八——编解码技术之JBoss Marshalling

    JBoss Marshalling 是一个java序列化包,对JDK默认的序列化框架进行了优化,但又保持跟java.io.Serializable接口的兼容,同时增加了一些可调参数和附加特性,这些参数 ...

  3. django 实现 内网访问 和 用花生壳进行内网穿透

    1.在setting.py中找到  ALLOWED_HOSTS = [] 改为 ALLOWED_HOSTS = ['*',]2.启动服务时使用如下命令行 python .\manage.py runs ...

  4. 049-PHP输出当前文件的名称

    <?php echo __FILE__; //利用常量__FILE__输出当前文件的名称 ?>

  5. 了解C#

    了解C C#能编写那些程序 Windows桌面应用程序 桌面应用有自己独立的进程与操作系统进行消息通讯,操作系统对事件进行检测,传递给桌面应用进程,桌面应用进程对这些消息进行解释,处理后,把处理结果u ...

  6. servlet 之 servlet接口详解

    package javax.servlet;   //Tomcat源码版本:6.0.20 import java.io.IOException; public interface Servlet { ...

  7. 干货分享:深度解析Supplement Essay写作

    今天Hotessay小编给同学们介绍下附加文书的创作思路.因为附加文书基本上都是短essay,所以简洁才是硬道理! 通常,我们可以把美国大学的附加文书分为以下几类: 1.Tell us about y ...

  8. 类成员之迭代iter

    class B: def __init__(self,name,age): self.name = name self.age = age #创建迭代方法 def __iter__(self): re ...

  9. Inception Score

    转载 https://www.jiqizhixin.com/articles/2019-01-10-18    全面解析Inception Score原理及其局限性 https://blog.csdn ...

  10. 【Python】【Django】登录用户-链接Mysql