Comments (6)
@MehSha hey!
Ok so I have no time at this moment to fix it but EOF means End Of File.
See this: https://github.com/0x19/goesl/blob/master/examples/client.go#L54
if !strings.Contains(err.Error(), "EOF")
What I would do on your place is just not treat EOF as error. I will attach later on code that will do the same.
For malformed MIME. Can you please give me a little bit more info, panic, data, something as it's very hard like this to tell what's the problem.
Thanks!
from goesl.
I have the same malformed MIME problem. Part of the JSON gets parsed as a header. It looks as if part of the text in the buffer is somehow skipped, which leads to incorrect parsing of the next message in the buffer and as a result an "unexpected end of JSON input" error occurs. Is it possible that the buffer is somehow overwritten/changed between the reads?
I can reproduce this 100%. It seems to happen when two events come at almost exactly the same time. The Content-Length header is then pre-pended with some JSON. The JSON part is in fact from the previous event in the stream. It looks like this:
map[{"Event-Name":["RE_SCHEDULE","Core-UUID":"5394f610-9504-4d11-a8e7-86f60fd13331","FreeSWITCH-Hostname":"fs1.example.com","FreeSWITCH-Switchname":"fs1.example.com","FreeSWITCH-IPv4":"10.10.10.10","FreeSWITCH-IPv6":"::1","Event-Date-Local":"2015-09-16 18:07:03","Event-Date-GMT":"Wed, 16 Sep 2015 16:07:03 GMT","Event-Date-Timestamp":"1442419623317552","Event-Calling-File":"switch_scheduler.c","Event-Calling-Function":"switch_scheduler_execute","Event-Calling-Line-Number":"71","Event-Sequence":"620500","Task-ID":"1","Task-Desc":"heartbeat","Task-Group":"core","Task-Runtime":"1442419643"}Content-Length: 608] Content-Type:[text/event-json]]
I have verified with a packet capture that the headers are correctly formatted and that the JSON is valid.
I also tried ignoring the "unexpected end of JSON input" error as suggested, but after that no more events get processed.
from goesl.
any fix, or any hint to fix it is much appreciated.
from goesl.
If that helps, I have also tested with https://github.com/fiorix/go-eventsocket and it parses all messages correctly. Maybe there is a hint in this code, which may help you identify the problem?
from goesl.
@MehSha and @htrendev thx on this finding! I will really do my best to get on this as soon as possible. Will try to get some time scheduled for this today or tomorrow.
from goesl.
offered patch is fixing a problem
from goesl.
Related Issues (20)
- client example falls HOT 1
- Api Response
- [Program Crash while listening to events]
- events of json type don't have their Content-Type header set
- can not receive CHANNEL_PARK message
- QUESTION: events per socketConnection or not HOT 9
- go1.12 and go-logging HOT 1
- playback fail
- Connection is closed on first unsuccessful result HOT 6
- connect client has ERROR Expected auth/request content type. Got text/rude-rejection
- could this dependency be managed by go.mod?
- no readevent()?
- Need a new developer?
- how set log level
- High CPU usage
- This is embarasing... Note to myself (and everyone else)! HOT 1
- >go get github.com/0x19/goesl fails HOT 2
- GoESL Client Queues Calls Without Originating After 96 Attempts HOT 1
- break with Gt new message: <nil>
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goesl.