Publish/Subscribe Quirk

Just realized for the first time that if you’re trying to subscribe to a published event between 2 Photons, your event name, if longer than one word, must be separated by underscores. Without the underscores, myHandler function was never firing because the Photon subscription wasn’t actually triggering.

Here’s an example of a properly formatted event name that could be subscribed to.

Here’s an example of an improperly formatted event name.
My published event

Your publishing Photon will still publish the event with this name, but you won’t be able to subscribe to it by its full name. Unless of course, you only use the first two letters “My,” which would count as a legal prefix.

Can anyone else confirm this for me?

@tommy_boy, spaces in event names, much like anything else in C++, cannot contain spaces. As you found out, the space delineates the variable name so in your case, only “My” was used. Not using spaces is typically good programmatic form in general. This is why the underscore is used as a replacement :smile:


Thanks for the clarification @peekay123. My error was rooted in the notion that the *data string displayed in a published event was the contents of the string itself and not the string variable name itself. Thanks again for the advice.