mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-13 02:49:58 +00:00
Fix sendMessage string handling (fixes #138)
This commit is contained in:
@@ -206,12 +206,17 @@ export default class Session {
|
|||||||
|
|
||||||
private _impl_sendMessage (
|
private _impl_sendMessage (
|
||||||
namespace: string
|
namespace: string
|
||||||
, message: object
|
, message: {} | string
|
||||||
, messageId: string) {
|
, messageId: string) {
|
||||||
|
|
||||||
let error = false;
|
let error = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// Decode string messages
|
||||||
|
if (typeof message === "string") {
|
||||||
|
message = JSON.parse(message);
|
||||||
|
}
|
||||||
|
|
||||||
this.createChannel(namespace);
|
this.createChannel(namespace);
|
||||||
this.channelMap.get(namespace)!.send(message);
|
this.channelMap.get(namespace)!.send(message);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|||||||
Reference in New Issue
Block a user