Comments (8)
Thank you for your response. My question wasn't very clear. The main issue I'm facing is not knowing how to send a MessageList through the Emit method. I've attempted to implement an interface myself, and it looks like this:
void USocketIOClientComponent::EmitMessages(const FString& EventName, const TArray<TSharedPtr<FJsonValue>>& Messages, const FString& Namespace)
{
if (Messages.Num() <= 0)
{
//Set the message is not null
TSharedPtr<FJsonValue> JsonMessage = MakeShareable(new FJsonValueNull);
NativeClient->Emit(EventName, JsonMessage, nullptr, Namespace);
return;
}
sio::message::list* MessageList = new sio::message::list();
for (int i = 0; i < Messages.Num(); i++)
{
MessageList->push(USIOMessageConvert::ToSIOMessage(Messages[i]));
}
NativeClient->EmitRaw(EventName, *MessageList, nullptr, Namespace);
delete MessageList;
}
I'm not sure if there's already a solution like this in the plugin, but my current implementation seems to meet my needs.
Thank you for all your assistance.
from socketioclient-unreal.
Can you point to socket.io protocol documentation of your requested feature?
from socketioclient-unreal.
I haven't found an exact example, but it should be similar to the image below:
This is what the JavaScript client looks like after encoding:
from socketioclient-unreal.
from socketioclient-unreal.
This looks like just a multiparam message which is supported via second param on function, see e.g. https://github.com/getnamo/SocketIOClient-Unreal?tab=readme-ov-file#emit-with-callback and https://github.com/getnamo/SocketIOClient-Unreal?tab=readme-ov-file#binding-events-to-functions
Or in c++ via
I generally recommend wrapping your multiparam into a single param as it isn't limited to function callback signature.
from socketioclient-unreal.
It seems I misunderstood, I do believe this variant:
Does the same, but if does not, feel free to open a pull request and I can merge the feature to mainline.
from socketioclient-unreal.
I tested the method above and didn't get the expected result:
The correct result should be:
["call","foo","bar"]
Implementing EmitMessagesWithCallback seems to be quite complex, and I'm not very proficient in C++. I'm worried that I might introduce bugs and may not be able to provide a fully functional PR.
from socketioclient-unreal.
Interesting, it does seems like the plugin is missing the implementation then. If you open a pull request with your current implementation, I'll apply patches to it to fit other methods before merging; it will give me a base scaffold to apply the rest of the functionality.
from socketioclient-unreal.
Related Issues (20)
- Editor crashes when using UE5.3 HOT 2
- Events not triggering after disconnect-connect. HOT 1
- Can you authorize me to use your network plugin in my plugin submission to the Unreal Marketplace? HOT 2
- Fatal error: [File:./Runtime/Core/Private/HAL/MallocBinned2.cpp] [Line: 1438] (Attempt to realloc an unrecognized block) UE 5.3.2 HOT 3
- Beautiful plugin. And thanks again for your fantastic explanation of the MIT license too, friend! HOT 1
- LogScript: Warning: Infinite script recursion (120 calls) detected - see log for stack trace InvitationSocket_C /Game/OCTOC/Maps/UEDPIE_0_Map_OCTOC_Components.Map_OCTOC_Components:PersistentLevel.InvitationSocket_C_1 Function /Game/OCTOC/Blueprints/InvitationMultiplayer/InvitationSocket.InvitationSocket_C:ExecuteUbergraph_InvitationSocket:0000
- 找不到组件? HOT 1
- Unable to build in UE5.3.2(Linux) HOT 1
- PrecompileForTargets = PrecompileTargetsType.Any fix for MP release
- Assertion Failed error while converting SoundWave to Bytes using ToBytes Node HOT 1
- Plugin does not build with strict includes HOT 2
- UE 5.4 support HOT 1
- Packaging for Android on UE 5.4.1 fails HOT 1
- IOS Crash on Connection or on receiving message (DIstribution package) HOT 2
- Cannot connect to SocketIO server HOT 1
- Severe collapse bug:Game Crash at Spawn actor of socketio HOT 4
- "connect_error" Messages Aren't Passed Through to Unreal Engine Client
- Crash UE5 (5.3.2) when I open an specific project HOT 5
- Could not find definition for module 'OpusAudioDecoder', (referenced via Target -> SocketIOClient.Build.cs -> SocketIOLib.Build.cs) at UE5.1.1 compile HOT 1
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 socketioclient-unreal.