Comments (6)
If you want send message to peer, you send like this:
public void SendChatMessage(string chat)
{
ProtocolDataModel pd = new ProtocolDataModel();
pd.Type = ProtocolType.TYPE_IM;
pd.Request = IMProtocol.IM_SENMESSAGE_CRES;
IMInfo info = new IMInfo();
info.UserID = ChatManager._instance.UserID;
info.PeerID = ChatUIManager._instance.SelectFriendID;
info.MessageData = ByteString.CopyFrom(Encoding.UTF8.GetBytes(chat));
using (MemoryStream stream = new MemoryStream())
{
info.WriteTo(stream);
pd.Message = stream.ToArray();
}
NetWorkManager.Instance.Send(pd);
}
receive like this:
IMHandler.cs
public void MessageReceive(ProtocolDataModel pdm)
{
switch (pdm.Request)
{
case IMProtocol.IM_NONE:
break;
case IMProtocol.IM_CALL_SRE:
peerCall(pdm);
break;
case IMProtocol.IM_STATE:
callResult(pdm);
break;
case IMProtocol.IM_ACCEPT_SRES:
peerAccept(pdm);
break;
case IMProtocol.IM_HANG_SRES:
peerHang(pdm);
break;
case IMProtocol.IM_SENMESSAGE_SRES:
peerMessage(pdm);
break;
}
}
private void peerMessage(ProtocolDataModel pdm)
{
IMInfo info = IMInfo.Parser.ParseFrom(pdm.Message);
string str = Encoding.UTF8.GetString(data);
}
==========
Also you can send float[] data with the video data.
UnityChatSDK.cs
public List<float> OptionlFloatData { get; } public void AddVideoFloatData(List<float> data = null)
from unitychatsdk.
from unitychatsdk.
Yes, this is an interface that you can only call and cannot modify.
from unitychatsdk.
from unitychatsdk.
Yes, I will separate the protocol in the next version, and then you can use any protocol.
from unitychatsdk.
from unitychatsdk.
Related Issues (15)
- Question about streaming video & audio from HoloLens HOT 3
- server linux HOT 1
- hi, I am willing to purchase UnityChatSDK HOT 1
- 啥时候支持MacOS HOT 1
- 有直播rtmp 推流的API接口吗?获取虚拟camera画面数据录频推流 HOT 1
- 请问支持webgl不? HOT 1
- How to tackle this problem:AssetDatabase' does not contain a definition for 'AllowAutoRefresh' HOT 2
- Trial time is up HOT 17
- Licence HOT 4
- Where I can buy licence other chinese language? HOT 4
- Paypal error HOT 1
- Paypal same error HOT 1
- Email receipt HOT 1
- audio problem HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unitychatsdk.