All Projects → GoBelieveIO → im_js

GoBelieveIO / im_js

Licence: other
im js sdk

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to im js

Im ios
GoBelieveIO IM iOS sdk
Stars: ✭ 116 (+146.81%)
Mutual labels:  free-software, im
Im service
golang im server
Stars: ✭ 1,694 (+3504.26%)
Mutual labels:  free-software, im
Im android
GoBelieveIO IM android sdk
Stars: ✭ 167 (+255.32%)
Mutual labels:  free-software, im
liground
A free, open-source and modern Chess Variant Analysis GUI for the 21st century
Stars: ✭ 41 (-12.77%)
Mutual labels:  free-software
i2pchat
🌀 i2pchat. Anonymous private secure opensource chat using end-to-end encrypted transport.
Stars: ✭ 25 (-46.81%)
Mutual labels:  im
fire-im
分布式IM服务,参考https://github.com/crossoverJie/cim 实现
Stars: ✭ 17 (-63.83%)
Mutual labels:  im
xcloud-dopaas
One stop solution of PaaS platform based on DevSecOps --- Based on SpringCloud/Docker/k8s/ServiceMesh(Istio), primary integrated modules: CMDB, Unified Continuous delivery of CI/CD (distributed compilation and deployment), IAM Certification Center, Unified monitoring center, Unified configuration center, Unified Distributed task scheduling cente…
Stars: ✭ 76 (+61.7%)
Mutual labels:  im
docs
Enterprise Open Source IM Solution
Stars: ✭ 18 (-61.7%)
Mutual labels:  im
CimIM
IM即时通信Android客户端
Stars: ✭ 14 (-70.21%)
Mutual labels:  im
onchat-web
A simple, beautiful, mobile-first instant messaging progressive web application.
Stars: ✭ 138 (+193.62%)
Mutual labels:  im
Android
Connect IM Android Project
Stars: ✭ 21 (-55.32%)
Mutual labels:  im
iGruppi
Applicativo per la gestione e l'ottimizzazione degli acquisti dei Gruppi di acquisto Solidali (G.A.S.)
Stars: ✭ 12 (-74.47%)
Mutual labels:  free-software
pentesting-multitool
Different utility scripts for pentesting and hacking.
Stars: ✭ 39 (-17.02%)
Mutual labels:  free-software
lemon-imui
基于 VUE 2.0 的 IM 聊天组件
Stars: ✭ 146 (+210.64%)
Mutual labels:  im
ios
Connect IM iOS Project
Stars: ✭ 13 (-72.34%)
Mutual labels:  im
ARChatRoom
应用场景包括:语聊房,语音开黑,狼人杀,陌生人交友,组队PK。支持Android 端、iOS 端。
Stars: ✭ 39 (-17.02%)
Mutual labels:  im
HeadOverHeels
The free and open source remake of game Head over Heels
Stars: ✭ 15 (-68.09%)
Mutual labels:  free-software
CoffeeChat
opensource im with server(go) and client(flutter+swift)
Stars: ✭ 111 (+136.17%)
Mutual labels:  im
Open-IM-SDK-Android
OpenIM:由IM技术专家打造的基于 Go 实现的即时通讯(IM)项目,Android版本IM SDK 可以轻松替代第三方IM云服务,打造具备聊天、社交功能的app。
Stars: ✭ 144 (+206.38%)
Mutual labels:  im
gmqtt
Golang MQTT Broker.
Stars: ✭ 75 (+59.57%)
Mutual labels:  im

#IM JS SDK

IMService Methods

  • constructor

    • Initializes the client
  • observer

    • handle messages that received from server
  • accessToken

    • property must be set before start
  • start

    • Start im service
  • stop

    • Stop im service
  • sendPeerMessage

    • Send a message to peer
    • Parameters
      • msg (Object): message property(sender, receiver, content, msgLocalID)
  • sendGroupMessage

    • Send a message to peer
    • Parameters
      • msg (Object): message property(sender, receiver, content, msgLocalID)

IMService Observer

  • onConnectState

    • callback when im service connection state changed
    • Parameters
      • state:im service's connect state
  • handlePeerMessage

    • callback when im service received a peer message
    • Parameters
      • msg (Object): message property(sender, receiver, content, timestamp)
  • handleMessageACK

    • callback when im service received an ack of message
    • Parameters
      • msg (Object): message property(sender, receiver, content, timestamp)
  • handleMessageFailure

    • callback when im service can't send out the message
    • Parameters
      • msg (Object): message property(sender, receiver, content, timestamp)
  • handleGroupMessage

    • callback when im service received a peer message
    • Parameters
      • msg (Object): message property(sender, receiver, content, timestamp)
  • handleGroupMessageACK

    • callback when im service received an ack of message
    • Parameters
      • msg (Object): message property(sender, receiver, content, timestamp)
  • handleGroupMessageFailure

    • callback when im service can't send out the message
    • Parameters
      • msg (Object): message property(sender, receiver, content, timestamp)

##example

<script src="https://github.com/im.js"></script>
<script>
  var observer = {
    handlePeerMessage: function (msg) {
        console.log("msg sender:", msg.sender, " receiver:", msg.receiver, " content:", msg.content, " timestamp:", msg.timestamp)
    },
    handleMessageACK: function(msg) {
        console.log("message ack local id:", msgLocalID, " receiver:", receiver)
    },
    handleMessageFailure: function(msg) {
        console.log("message fail local id:", msgLocalID, " receiver:", receiver)
    },
    onConnectState: function(state) {
        if (state == IMService.STATE_CONNECTED) {
           console.log("im connected");
        } else if (state == IMService.STATE_CONNECTING) {
           console.log("im connecting");
        } else if (state == IMService.STATE_CONNECTFAIL) {
           console.log("im connect fail");
        } else if (state == IMService.STATE_UNCONNECTED) {
           console.log("im unconnected");
        }
    },

    handleGroupMessage: function(msg) {
        console.log("group msg sender:", msg.sender, " receiver:", msg.receiver, " content:", msg.content, " timestamp:", msg.timestamp)
    },
    handleGroupMessageACK: function(msg) {
        console.log("group message ack:", msg);
    },
    handleGroupMessageFailure: function(msg) {
        console.log("group message fail:", msg);
    },
    handleGroupNotification(notification) {
        var obj = JSON.parse(notification);
        console.log("group notification:", obj);
    },
  }
  
  var im = new IMService();
  im.observer = observer;
  im.accessToken = "????";
  im.start()

  var msg = {sender:100, receiver:200, content:"11", msgLocalID:1000}

  //connectState == STATE_CONNECTING
  var r = im.sendPeerMessage(msg);
  //r == false
  console.log("send message result:", r);


  function send() {
      var msg = {sender:100, receiver:100, content:"11", msgLocalID:1000}
      if (im.connectState == IMService.STATE_CONNECTED) {
          im.sendPeerMessage(msg);
      }
  }

  setTimeout(send, 2000)
</script>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].