rolandoislas / BrightWebSocket

RFC 6455 WebSocket Library for the Roku
Other
14 stars 11 forks source link

ComponentLibrary json path issue #3

Closed lkrocek closed 6 years ago

lkrocek commented 6 years ago

https://github.com/rolandoislas/BrightWebSocket/blob/37fa3ac1b037c0148021634d3e5f726eac7f3cd3/src/web_socket_client/Logger.brs#L72

In a case I want use it in ComponentLibrary, I am unable to access it-self path as pkg:/ which is path of main application and not current component, even it is strange I am actually unable to read files of it-self in brightscript.

Change it to be assocarray field with default value of this task, please.

rolandoislas commented 6 years ago

This is meant to be a configuration file specific to the app utilizing the library (i.e. bright_web_socket.json should be in the main application's package root). This allows the logging level to be configured without modification to the library itself.

lkrocek commented 6 years ago

I understand, but if I want to write ComponentLibrary I cannot use readAsciiFile("pkg:/bright_web_socket.json") because pkg:/ is not a path of my ComponentLibrary, sadly it means I cannot use any I/O ops in brightScript of my ComponentLibrary.

I would like write libs which could be used in any application and will independent.

lkrocek commented 6 years ago

At least it could be working with both cases, if config given as field don't lookup for file ...

cdthompson commented 6 years ago

@lkrocek you should be able to s/pkg/libpkg/ and have it working, i believe.

lkrocek commented 6 years ago

this will not help even libpkg will be working, because the address is apart of this library and I have to still modify the address in this lib. I would like have an original library without modification inside.

rolandoislas commented 6 years ago

I am unclear on the request. Are you asking for an exposed method of changing the settings handled by bright_web_socket.json (which only controls logging) at runtime?

lkrocek commented 6 years ago

_Simply my request is about to possibility to change pkg:/bright_web_socket.json address or in best case to pass its data with same way as a programmer passing url of server, so via interface._

I can try to explain one more:

I believe to do not modify 3rd party libs as this one to keep it simple maintainable for updates etc.

So with this idea I cannot do any changes within lib including address as "pkg:/bright_web_socket.json", so this address must be unchanged, but in component lib it follows into package and not into lib package. So whoever will use my lib will require to own this file in his/her own app(s), but it's not required because this should be for my library usage and not final applications.

If you are not sure what I mean maybe it's simplest way to do your own Unsigned Component Library with usage of you awesome WebSocketClient component.

rolandoislas commented 6 years ago

A new commit to the develop branch exposes the log_level field in WebSocketClient.xml. It can be set to one of the log level strings.

lkrocek commented 6 years ago

perfect it works.