Giter VIP home page Giter VIP logo

Comments (15)

neuecc avatar neuecc commented on May 14, 2024

it is caused from does not call RegisterStreamingMethod before call at once.
requires OnJoin before Broadcast...
However, null is not desirable, so I'd like to fix it.
thanks.

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024

So how do I fix this problem now?

from magiconion.

neuecc avatar neuecc commented on May 14, 2024

Who calls BroadcastAll?
In the chat scenario, although I think that someone will surely start after Join.

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024
public async Task<ServerStreamingResult<ChatRoomMember>> OnJoin()
{
  return await GetStreamingContextRepository().RegisterStreamingMethod(this, OnJoin);
}

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024

Now this problem can not be resolved, there are other ways, I do not know where to modify.

from magiconion.

neuecc avatar neuecc commented on May 14, 2024

please show reproduce client code.
below code is works fine.

static async Task RunChat(ChannelContext ctx)
{
    // create room
    var client = ctx.CreateClient<IChatRoomService>();

    var room = await await client.CreateNewRoom("test", "A"); // TODO:IChatRoomCommand sample is old so require await await...

    var result = await await client.SendMessage(room.Id, "foo bar baz");
    Console.WriteLine("Send success:" + result);
}

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024
public IEnumerator Join(string roomId, string nickName)
{
       var r = client.Join(roomId, nickName).ResponseAsync.ToYieldInstruction();
       yield return r;
}

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024

Do you need to do two "ToYieldInstruction" here?

from magiconion.

neuecc avatar neuecc commented on May 14, 2024

ah, sorry, require subscribe OnJoin before do anything.

from magiconion.

neuecc avatar neuecc commented on May 14, 2024

I've fixed sample code and upload v0.5.1.1 includes this fix.
4d1c8af

main fix is add new api, when creating StreamingContextRepository

new StreamingContextRepository<IChatRoomStreaming>(connection, this);

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024

Sorry, did not see the version update!

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024

public async UnaryResult<RoomResponse> CreateNewRoom(string roomName, string nickName)
Are you sure you can write this way?
Why the editor that need to add Task , or can not use async.

from magiconion.

neuecc avatar neuecc commented on May 14, 2024

this is for C# 7.0 only, if you have to use old c#, change signature to Task<UnaryResult<T>>.
(but for Unity, generates IObservable<T> code).

from magiconion.

yoohoxiao avatar yoohoxiao commented on May 14, 2024
public interface IChatRoomCommand
{
           IObservable<UnaryResult<global::ShareType.RoomResponse>> CreateNewRoom(string roomName, string nickName);
}

Does Unity3d need this?

from magiconion.

neuecc avatar neuecc commented on May 14, 2024

moc.exe automatically convert and generate interface.
like this https://github.com/neuecc/MagicOnion/blob/master/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnionGenerated.cs#L369-L381

from magiconion.

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.