[Unity] Client is not receiving message from server.
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
In Unity 2018.2.16f, I'm trying to create both server and client in the editor.
I'm running the server code first:
IEnumerator ServerInit()
{
var wssv = new WebSocketServer ("ws://127.0.0.1:9528");
wssv.AddWebSocketService<Laputa> ("/Laputa");
wssv.Start ();
yield return 0;
}
public class Laputa : WebSocketBehavior
{
protected override void OnMessage (MessageEventArgs e)
{
var msg = e.Data == "BALUS"
? "I've been balused already..."
: "I'm not available now.";
Send (msg);
}
}
After few seconds I'm executing the client code:
IEnumerator ClientCoroutine()
{
using (var ws = new WebSocket("ws://127.0.0.1:9528/Laputa"))
{
ws.OnMessage += (sender, e) =>
print("Laputa says: " + e.Data);
ws.Connect();
ws.Send("BALUS");
}
yield return 0;
}
But there is not message is receiving. There is no error either. Looks like nothing is happening. What am I missing?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the server and client coroutines in Unity 2018.2.16f with websocket-sharp, then trace the WebSocket Connect, Send, and OnMessage flow shown in the issue. Done means identifying why the server response is not received and confirming the client prints the reply or documenting the missing setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- game-dev, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100