socketio-file-upload icon indicating copy to clipboard operation
socketio-file-upload copied to clipboard

Customize topic name

Open AMontagu opened this issue 6 years ago • 1 comments

Hello !

Thank you for this project !

I need to transfer files from a client to an other client. Depending of the topic the final client change. I have already all logic to dispatch the message from the server depending of the topic name.

My question: Are you interested in a PR to allow customizing topic name ?

ex:

socket.emit(`${customTopic}_progress`, {
				id: id,
				size: file.size,
				start: start,
				end: end,
				content: content,
				base64: isBase64
			});

I need to do it anyway. But if you want I can share my result in a PR and take any good advice from you before do so.

AMontagu avatar Nov 08 '18 14:11 AMontagu

Sure! For example, call the new option messageNamePrefix, and have it default to siofu.

For the unit test, probably just set some arbitrary custom value to the new option, and assert on the server side and client side that the received messages names are consistent.

sffc avatar Nov 08 '18 18:11 sffc