Skip to content

Conversation

mgbckr
Copy link
Contributor

@mgbckr mgbckr commented Jul 19, 2017

Hi, I had an issue with connecting to a Spring based SockJS+STOMP endpoint. Specifically the default settings of Spring do not allow an "Origin" header which is hardcoded in the current version of the arduinoWebSockets library. Also, there was no example how to handle SockJS+STOMP.

This pull request adds the capability of removing the hardcoded "Origin" header and enables the user to set custom headers. Additionally it provides an example for connecting to a Spring based SockJS+STOMP endpoint.

There are probably ways to do this more elegantly (like using String arrays to specify headers) or efficiently (e.g., using preprocessor statements), but I opted for the fasted way to implement this. Let me know what you think.

This pull request is somewhat related to issues #131 and #182 . If I have missed already existing functionality, please kindly ignore and delete this request 😏

mgbckr added 6 commits July 18, 2017 12:37
The origin header often makes trouble with current WebSocket implementations. Thus, we introduce the WEBSOCKET_HEADERS_NO_ORIGIN macro which disables this header it if defined.
Copy link
Owner

@Links2004 Links2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looking fine,
the *.ino code style looks off some how (space/tap).
using a simple string for the header is fine for now,
implementing a linked string list for this looks overkill to me since for the moment it will be mostly not used and makes it unnecessary complex.

void setAuthorization(const char * auth);

void setExtraHeaders(const char * extraHeaders = NULL);
void setExtraHeaders(char * extraHeaders);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the Implementation of void setExtraHeaders(char * extraHeaders);?
may simple remove it. const char * will work fine for text data.

@mgbckr
Copy link
Contributor Author

mgbckr commented Jul 20, 2017

Hi, I fixed the indent (IDE was set to tab size 2) and removed the redundant function specification.

@Links2004 Links2004 merged commit adb255b into Links2004:master Jul 20, 2017
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

Successfully merging this pull request may close these issues.

2 participants