WebIMConfig.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. /**
  2. * git do not control webim.config.js
  3. * everyone should copy webim.config.js.demo to webim.config.js
  4. * and have their own configs.
  5. * In this way , others won't be influenced by this config while git pull.
  6. *
  7. */
  8. // for react native
  9. // var location = {
  10. // protocol: "https"
  11. // }
  12. function getUrl(){
  13. var apiUrl = (window.location.protocol === "https:" ? "https:" : "http:") + "//a1-hsb.easemob.com"
  14. var xmppUrl = "im-api.easemob.com"
  15. if(window.location.href.indexOf("webim-h5.easemob.com") !== -1 || window.location.href.indexOf("localhost") !== -1 || window.location.href.indexOf("172.17.2.168") !== -1){
  16. apiUrl = (window.location.protocol === "https:" ? "https:" : "http:") + "//a1-hsb-ly.easemob.com"
  17. xmppUrl = "im-api.easemob.com"
  18. }
  19. // else if(window.location.href.indexOf("webim-hsb.easemob.com") !== -1){
  20. // apiUrl = (window.location.protocol === "https:" ? "https:" : "http:") + "//a1-hsb.easemob.com"
  21. // xmppUrl = "im-api-hsb.easemob.com"
  22. // }
  23. return {
  24. apiUrl: apiUrl,
  25. xmppUrl: xmppUrl
  26. }
  27. }
  28. var config = {
  29. /*
  30. * XMPP server
  31. */
  32. xmppURL: (window.location.protocol === "https:" ? "https:" : "http:") + "//im-api-v2.easemob.com/ws",
  33. // xmppURL: "im-api.easemob.com",
  34. // xmppURL: '172.17.2.139:5280',
  35. /*
  36. * Backend REST API URL
  37. */
  38. // apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//a1.easemob.com',
  39. // ios must be https!!! by lwz
  40. // apiURL: "https://a1.easemob.com",
  41. apiURL: (window.location.protocol === "https:" ? "https:" : "http:") + "//a1.easemob.com",
  42. // apiURL: (location.protocol === 'https:' ? 'https:' : 'http:') + '//172.17.3.155:8080',
  43. /*
  44. * Application AppKey
  45. */
  46. appkey: "easemob-demo#easeim",
  47. // appkey: "1108200309157490#bpttest",
  48. /*
  49. * Application Host
  50. */
  51. Host: "easemob.com",
  52. /*
  53. * Whether to use HTTPS
  54. * @parameter {Boolean} true or false
  55. */
  56. https: true,
  57. isHttpDNS: false,
  58. /*
  59. * isMultiLoginSessions
  60. * true: A visitor can sign in to multiple webpages and receive messages at all the webpages.
  61. * false: A visitor can sign in to only one webpage and receive messages at the webpage.
  62. */
  63. isMultiLoginSessions: true,
  64. /**
  65. * Whether to use window.doQuery()
  66. * @parameter {Boolean} true or false
  67. */
  68. isWindowSDK: false,
  69. /**
  70. * isSandBox=true: xmppURL: 'im-api.sandbox.easemob.com', apiURL: '//a1.sdb.easemob.com',
  71. * isSandBox=false: xmppURL: 'im-api.easemob.com', apiURL: '//a1.easemob.com',
  72. * @parameter {Boolean} true or false
  73. */
  74. isSandBox: false,
  75. /**
  76. * Whether to console.log in strophe.log()
  77. * @parameter {Boolean} true or false
  78. */
  79. isDebug: true,
  80. /**
  81. * Whether to show logs in strophe
  82. * @parameter {Boolean} true or false
  83. */
  84. isStropheLog: false,
  85. /**
  86. * will auto connect the xmpp server autoReconnectNumMax times in background when client is offline.
  87. * won't auto connect if autoReconnectNumMax=0.
  88. */
  89. autoReconnectNumMax: 5,
  90. /**
  91. * the interval secons between each atuo reconnectting.
  92. * works only if autoReconnectMaxNum >= 2.
  93. */
  94. autoReconnectInterval: 2,
  95. /**
  96. * webrtc supports WebKit and https only
  97. */
  98. isWebRTC: window.RTCPeerConnection && /^https\:$/.test(window.location.protocol),
  99. /**
  100. * cn: chinese
  101. * us: english
  102. */
  103. i18n: "cn",
  104. /*
  105. * Set to auto sign-in
  106. */
  107. isAutoLogin: true,
  108. /**
  109. * Size of message cache for person to person
  110. */
  111. p2pMessageCacheSize: 500,
  112. /**
  113. * When a message arrived, the receiver send an ack message to the
  114. * sender, in order to tell the sender the message has delivered.
  115. * See call back function onReceivedMessage
  116. */
  117. delivery: false,
  118. /**
  119. * Size of message cache for group chating like group, chatroom etc
  120. */
  121. groupMessageCacheSize: 200,
  122. /**
  123. * 5 actual logging methods, ordered and available:
  124. * 'TRACE', 'DEBUG', 'INFO', 'WARN', 'ERROR'
  125. */
  126. loglevel: "ERROR",
  127. /**
  128. * enable localstorage for history messages
  129. */
  130. enableLocalStorage: true
  131. }