Giter VIP home page Giter VIP logo

Comments (3)

wangxiao avatar wangxiao commented on May 18, 2024

什么意思?回调想要什么结果?

from js-realtime-sdk.

lzwjava avatar lzwjava commented on May 18, 2024

我想要的是那个message。想发送完回调 的data 跟我log拉取历史消息的 是一样的。有 timestamp、fromPeerId、msg.type 等属性。现在我是自己构造了一个 message 来统一处理(因为回调给我的是 ack 命令),

    room.send({
        text: val
    }, {
        type: 'text'
    }, function (data) {

        // 发送成功之后的回调
        inputSend.value = '';
        data.msg = {};
        data.timestamp = new Date();
        data.msg.type = 'text';
        data.msg.text = val;
        data.fromPeerId = rt.cache.options.peerId;
        showMsg(data);
        printWall.scrollTop = printWall.scrollHeight;
    });

https://github.com/leancloud/leanchat-cloudcode/blob/master/webapp/app/scripts/test.js#L337-L352

from js-realtime-sdk.

wangxiao avatar wangxiao commented on May 18, 2024

理解你的意思了,就是现在回调的 data 是不统一 的,确实有可能。
另外,代码中不要使用 cache 中的值。

from js-realtime-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.