-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
websocket server sends duplicate message headers in protos response #246
Comments
Before this issue gets solved, what is the best workaround? I need to run gazebo as a websocket server so I can use gzweb2 to render on webpage. |
Not sure if this is helpful but my current "workaround" is to just not migrate to harmonic, this is the only thing that is stopping me from migrating from fortress. |
After some testing, I was able to see that gz::msgs::Factory::Types(types); This would make it an issue with I was able to come-up with a dirty fix on the std::set<std::string> processedDescriptors;
// Get all the messages, and build a single proto to send to the client.
for (auto const &type : types)
{
auto msg = gz::msgs::Factory::New(type);
if (msg)
{
auto descriptor = msg->GetDescriptor();
if (descriptor){
std::string descriptorStr = descriptor->DebugString();
std::string firstLine = descriptorStr.substr(0, descriptorStr.find('\n'));
if (processedDescriptors.find(firstLine) != processedDescriptors.end())
{
gzdbg << "Skipping duplicate descriptor[" << firstLine << "]\n";
continue; // Skip if the first line of the descriptor has already been processed
}
allProtos += descriptorStr;
gzdbg << descriptorStr;
processedDescriptors.insert(firstLine); // Mark this descriptor as processed
}
else
{
gzerr << "Failed to get the descriptor for message["
<< type << "]\n";
}
}
else
{
gzerr << "Failed to build message[" << type << "].\n";
}
} |
I created a couple of PRs:
I think that may fix the issue. I was able to get shapes.sdf working after these changes. |
Environment
Binary gz-harmonic package from ubuntu-stable
Description
Steps to reproduce
gz sim -v 4 -s -r shapes.sdf
gz launch -v 4 /usr/share/gz/gz-launch7/configs/websocket.gzlaunch
Output
If you open up the dev-tools on the browswer and then look at console, you will see the error:
Switching to network and filtering by WebSocket requests, you will see that gzweb sends protos request. (Looking at the gz_launch console log will also show that it has been received). Then the response, when viewed as UTF-8 will see the proto headers sent below. After Wrench message it seems to repeat? Response from gz-garden and gz-harmonic are attached. Note: that the web visualisation works with garden and fortress (as per the steps above)
gz-garden-response.txt
gz-harmonic-response.txt
Not sure if these duplicate headers are the problem but seems like a bug
The text was updated successfully, but these errors were encountered: