Skip to content

Commit

Permalink
Merge 952ae1b into 88c2355
Browse files Browse the repository at this point in the history
  • Loading branch information
nkoenig authored Apr 12, 2021
2 parents 88c2355 + 952ae1b commit 301073d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
31 changes: 31 additions & 0 deletions plugins/websocket_server/WebsocketServer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,37 @@ void WebsocketServer::OnMessage(int _socketId, const std::string &_msg)
this->QueueMessage(this->connections[_socketId].get(),
data.c_str(), data.length());
}
/// \todo(nkoeng) Deprecate this in Ignition Fortress, and instruct users
/// to rely on the "scene" message.
else if (frameParts[0] == "particle_emitters")
{
igndbg << "Particle emitter request received for world["
<< frameParts[1] << "]\n";
ignition::msgs::Empty req;
req.set_unused(true);

ignition::msgs::ParticleEmitter_V rep;
bool result;
unsigned int timeout = 2000;

std::string serviceName = std::string("/world/") + frameParts[1] +
"/particle_emitters";

bool executed = this->node.Request(serviceName, req, timeout, rep, result);
if (!executed || !result)
{
ignerr << "Failed to get the particle emitter information for "
<< frameParts[1] << " world.\n";
}

std::string data = BUILD_MSG(this->operations[PUBLISH], frameParts[0],
std::string("ignition.msgs.ParticleEmitter_V"),
rep.SerializeAsString());

// Queue the message for delivery.
this->QueueMessage(this->connections[_socketId].get(),
data.c_str(), data.length());
}
else if (frameParts[0] == "sub")
{
// Store the relation of socketId to subscribed topic.
Expand Down
9 changes: 5 additions & 4 deletions plugins/websocket_server/WebsocketServer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ namespace ignition
/// 2. "pub": Publish a message from the Ignition Transport topic in
/// the `topic_name` component,
/// 3. "topics": Get the list of available topics,
/// 3. "topics-types": Get the list of available topics and their
/// message types, and
/// 4. "protos": Get a string containing all the protobuf
/// definitions.
/// 4. "topics-types": Get the list of available topics and their
/// message types,
/// 5. "protos": Get a string containing all the protobuf
/// definitions, and
/// 6. "particle_emitters": Get the list of particle emitters.
///
/// The `topic_name` component is mandatory for the "sub" and "pub"
/// operations. If present, it must be the name of an Ignition Transport
Expand Down

0 comments on commit 301073d

Please sign in to comment.