Skip to content
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

Microserver Listen() method return reflect error #16

Open
eugbyte opened this issue Sep 28, 2022 · 0 comments
Open

Microserver Listen() method return reflect error #16

eugbyte opened this issue Sep 28, 2022 · 0 comments

Comments

@eugbyte
Copy link

eugbyte commented Sep 28, 2022

When using the Listen() method, I am getting this error:

Client

gosf.RegisterMicroservice("utils", "127.0.0.1", 4000, false)
	_ = gosf.NewSuccessMessage("Echo this...")

	msUtils := gosf.GetMicroservice("utils")
	if msUtils == nil {
		panic("unable to get a reference to utils microservice")
	}

	msUtils.Listen("telemetry", func(message *gosf.Message) {
		fmt.Println(message.Text)
	})

I am getting this error:

panic: reflect: Call using *gosocketio.Channel as type *gosf.Message

goroutine 37 [running]:
reflect.Value.call({0x10a7440?, 0xc00030c050?, 0xc000070c00?}, {0x10e7d8c, 0x4}, {0xc000299ee0, 0x1, 0xc00030c0e0?})
        C:/Program Files/Go/src/reflect/value.go:411 +0x19ff
reflect.Value.Call({0x10a7440?, 0xc00030c050?, 0xc00030c0e0?}, {0xc000299ee0, 0x1, 0x2})
        C:/Program Files/Go/src/reflect/value.go:339 +0xbf
github.com/ambelovsky/gosf-socketio.(*caller).callFunc(0xc000304060, 0x10a7f00?, {0x10a3a60?, 0x1306428?})

Server

I am using socket.io js in the server

io.on("connection", (socket: Socket) => {

    console.log("server: connected");
    setInterval(() => {
        const time = new Date().getTime();
        console.log("emitting event: telemetry, ", time)
        socket.emit("telemetry", {Text: time});
    }, 1000);

    socket.on("connect_error", (err) => {
        console.log(`connect_error due to ${err.message}`);
      });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant